From cfd337476a17e328623f907b0673aed556a47f36 Mon Sep 17 00:00:00 2001 From: Nikita Salnikov-Tarnovski Date: Mon, 24 May 2021 16:54:33 +0300 Subject: [PATCH] Add `OTEL_SERVICE_NAME` environment variable (#1677) * Add OTEL_SERVICE_NAME environment variable Closes #709 --- CHANGELOG.md | 2 ++ spec-compliance-matrix.md | 1 + .../resource/semantic_conventions/README.md | 13 ++++++++++++- specification/sdk-environment-variables.md | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5df7eabb78..36e889a4c2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ release. ### SDK Configuration +- Add `OTEL_SERVICE_NAME` environment variable. ([#1677](https://github.com/open-telemetry/opentelemetry-specification/pull/1677)) + ## v1.3.0 (2021-05-05) ### Context diff --git a/spec-compliance-matrix.md b/spec-compliance-matrix.md index cc32e58c200..56b7acad94f 100644 --- a/spec-compliance-matrix.md +++ b/spec-compliance-matrix.md @@ -131,6 +131,7 @@ Note: Support for environment variables is optional. |Feature |Go |Java|JS |Python|Ruby|Erlang|PHP|Rust|C++|.Net|Swift| |----------------------------------------------|---|----|---|------|----|------|---|----|---|----|-----| |OTEL_RESOURCE_ATTRIBUTES | + | + | + | + | + | + | - | + | + | + | - | +|OTEL_SERVICE_NAME | | | | | | | | | | | | |OTEL_LOG_LEVEL | - | - | + | [-][py1059] | + | + | - | | - | - | - | |OTEL_PROPAGATORS | - | + | | + | + | + | - | - | - | - | - | |OTEL_BSP_* | - | + | | + | + | + | - | + | - | - | - | diff --git a/specification/resource/semantic_conventions/README.md b/specification/resource/semantic_conventions/README.md index 8a329775cc2..d4a1ed9772a 100644 --- a/specification/resource/semantic_conventions/README.md +++ b/specification/resource/semantic_conventions/README.md @@ -36,9 +36,20 @@ Attributes are grouped logically by the type of the concept that they described. Certain attribute groups in this document have a **Required** column. For these groups if any attribute from the particular group is present in the Resource then all attributes that are marked as Required MUST be also present in the Resource. However it is also valid if the entire attribute group is omitted (i.e. none of the attributes from the particular group are present even though some of them are marked as Required in this document). +## Attributes with Special Handling + +Given their significance some resource attributes are treated specifically as described below. + +### Semantic Attributes with Dedicated Environment Variable + +These are the attributes which MAY be configurable via a dedicated environment variable +as specified in [OpenTelemetry Environment Variable Specification](../../sdk-environment-variables.md): + +- [`service.name`](#service) + ## Semantic Attributes with SDK-provided Default Value -These are the the attributes which MUST be provided by the SDK +These are the attributes which MUST be provided by the SDK as specified in the [Resource SDK specification](../sdk.md#sdk-provided-resource-attributes): - [`service.name`](#service) diff --git a/specification/sdk-environment-variables.md b/specification/sdk-environment-variables.md index 04e49f9bd72..dd2c22d0231 100644 --- a/specification/sdk-environment-variables.md +++ b/specification/sdk-environment-variables.md @@ -32,6 +32,7 @@ For example, the value `12000` indicates 12000 milliseconds, i.e., 12 seconds. | 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. | +| OTEL_SERVICE_NAME | Sets the value of the [`service.name`](./resource/semantic_conventions/README.md#service) resource attribute | | If `service.name` is also provided in `OTEL_RESOURCE_ATTRIBUTES`, then `OTEL_SERVICE_NAME` takes precedence. | | OTEL_LOG_LEVEL | Log level used by the SDK logger | "info" | | | OTEL_PROPAGATORS | Propagators to be used as a comma separated list | "tracecontext,baggage" | Values MUST be deduplicated in order to register a `Propagator` only once. | | OTEL_TRACES_SAMPLER | Sampler to be used for traces | "parentbased_always_on" | See [Sampling](./trace/sdk.md#sampling) |