Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added resource detection spec #811

Merged
4 changes: 4 additions & 0 deletions specification/library-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ For example:
- Python and Java: opentelemetry-exporter-jaeger
- Javascript: @opentelemetry/exporter-jeager

#### Resource Detection

Cloud vendors are encouraged to provide packages to detect resource information from the environment. These MUST be implemented outside of the SDK. See [Resource SDK](./resource/sdk.md#detecting-resource-information-from-the-environment) for more details.

### Alternative Implementations

The end-user application may decide to take a dependency on alternative implementation.
Expand Down
34 changes: 34 additions & 0 deletions specification/resource/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,40 @@ resource.
Note that the OpenTelemetry project documents certain ["standard
attributes"](semantic_conventions/README.md) that have prescribed semantic meanings.

### Detecting resource information from the environment

Custom resource detectors related to specific environments (e.g. specific cloud
carlosalberto marked this conversation as resolved.
Show resolved Hide resolved
vendors) MUST be implemented as packages separate from the SDK.

Resource detector packages MUST provide a method that returns a single resource.
james-bebbington marked this conversation as resolved.
Show resolved Hide resolved
This can then be associated with `TracerProvider` or `MeterProvider` instances
as described above.

Resource detector packages MAY detect resource information from multiple
possible sources and merge the result using the `Merge` operation described
above.

Resource detection logic MUST be synchronous and is expected to complete quickly
carlosalberto marked this conversation as resolved.
Show resolved Hide resolved
since this is run during application initialization. Errors should be handled as
specified in the [Error Handling
principles](../error-handling.md#basic-error-handling-principles). Note the
failure to detect any resource information MUST NOT be considered an error,
whereas an error that occurs during an attempt to detect resource information
SHOULD be considered an error.

### Specifying resource information via an environment variable

The SDK MUST extract information from the `OTEL_RESOURCE_ATTRIBUTES` environment
variable and merge this, as the secondary resource, with any resource
information provided by the user.
carlosalberto marked this conversation as resolved.
Show resolved Hide resolved

The `OTEL_RESOURCE_ATTRIBUTES` environment variable will contain of a list of
key value pairs, and these are expected to be represented in a format matching
to the [W3C
Correlation-Context](https://github.com/w3c/correlation-context/blob/master/correlation_context/HTTP_HEADER_FORMAT.md#header-value),
except that additional semi-colon delimited metadata is not supported, i.e.:
`key1=value1,key2=value2`. All attribute values MUST be considered strings.

## Resource operations

Resources are immutable. Thus, in addition to resource creation,
Expand Down
10 changes: 5 additions & 5 deletions specification/sdk-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ The goal of this specification is to unify the environment variable names betwee

## General SDK Configuration

| Name | Description | Default | Notes |
| -------------------- | ------------------------------------------------ | --------------------------------- | ------------------------------------------------------------------------------------------- |
| OTEL_RESOURCE_ATTRIBUTES | Key-value pairs to be used as resource attributes | | Spec details TBD. Proposal in [OTEP-111](https://github.com/open-telemetry/oteps/pull/111). |
| OTEL_LOG_LEVEL | Log level used by the SDK logger | "info" | |
| OTEL_PROPAGATORS | Propagators to be used as a comma separated list | "tracecontext,correlationcontext" | |
| Name | Description | Default | Notes |
| ------------------------ | ------------------------------------------------- | --------------------------------- | ----------------------------------- |
| OTEL_RESOURCE_ATTRIBUTES | Key-value pairs to be used as resource attributes | - | See [Resource SDK](./resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. |
james-bebbington marked this conversation as resolved.
Show resolved Hide resolved
| OTEL_LOG_LEVEL | Log level used by the SDK logger | "info" | |
| OTEL_PROPAGATORS | Propagators to be used as a comma separated list | "tracecontext,correlationcontext" | |

## Batch Span Processor

Expand Down