Skip to content

Commit

Permalink
Add support for the OTEL_SERVICE_NAME env var (open-telemetry#121)
Browse files Browse the repository at this point in the history
* Add support for the OTEL_SERVICE_NAME env var

* Account for srv name in code

* Rely on OTel for assignment and precedence

Co-authored-by: Owais Lone <[email protected]>
  • Loading branch information
MrAlias and owais authored Sep 1, 2021
1 parent 7621bbb commit 5c30695
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

## Unreleased

### Repository

### Configuration

- Add support for the `OTEL_SERVICE_NAME` environment variable.
- Remove suggestion for end users of instrumentation libraries to provide
configuration.

Expand Down
17 changes: 9 additions & 8 deletions specification/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,17 @@ beyond the OpenTelemetry specification exist.

#### [OpenTelemetry Environment Variable](https://github.com/open-telemetry/opentelemetry-specification/blob/f228a83e652e5cd3ba96b9f780b704ee7a7daa4c/specification/sdk-environment-variables.md)

- `OTEL_RESOURCE_ATTRIBUTES`
- User MUST define [`service.name`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service)
resource attribute.
- Distribution MUST log a warning when the `service.name` resource attribute is not set. The
warning message MUST clearly describe how to set the attribute or link to relevant documentation.
E.g.
- `OTEL_SERVICE_NAME`
- Users MUST define a name for the service they are instrumenting. The
service name can either be defined using the `OTEL_SERVICE_NAME` or
`OTEL_RESOURCE_ATTRIBUTES` environment variable, or directly in their code.
If the user fails to define a service name the distribution MUST log a
warning. The warning message MUST clearly describe how to set the service
name or link to relevant documentation. E.g.
```
service.name attribute is not set, your service is unnamed and will be difficult to identify.
set your service name using the OTEL_RESOURCE_ATTRIBUTES environment variable.
E.g. `OTEL_RESOURCE_ATTRIBUTES="service.name=<YOUR_SERVICE_NAME_HERE>"`
set your service name using the OTEL_SERVICE_NAME environment variable.
E.g. `OTEL_SERVICE_NAME="<YOUR_SERVICE_NAME_HERE>"`
```
- `OTEL_PROPAGATORS`
- Distribution MUST default to `"tracecontext,baggage"`
Expand Down

0 comments on commit 5c30695

Please sign in to comment.