[Discuss] Listen to OpenTelemetry environment configuration by default
- Dominant language
- Gherkin
- Stars
- 427
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
Relates to: https://github.com/elastic/apm/pull/813 where we'd listen to `OTEL_*` environment variables in the context of logging.
If we agree to make our `ecs-logging` OpenTelemetry aware it makes sense to extend the same logic to our agent configuration.
Quick summary is to propose adding support for the following `OTEL_*` environment variables.
- `OTEL_SDK_DISABLED`
- `OTEL_RESOURCE_ATTRIBUTES`
- `OTEL_SERVICE_NAME`
- `OTEL_LOG_LEVEL`
This would create a new resolving logic for the listed APM Agent configuration items:
- [`Enabled`](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-core.html#config-enabled)
- `ELASTIC_APM_ENABLED`
- the negation of `OTEL_SDK_DISABLED` if set
- defaults to `true`
- [`ServiceName`](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-core.html#config-service-name)
- `ELASTIC_APM_SERVICE_NAME`
- `OTEL_SERVICE_NAME`
- `OTEL_RESOURCE_ATTRIBUTES` value for `service.name`
- defaults to agents current service name detection defaults.
- [`ServiceVersion`](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-core.html#config-service-version)
- `ELASTIC_APM_SERVICE_VERSION`
- `OTEL_RESOURCE_ATTRIBUTES` value for `service.version`
- defaults to agents current service version detection
- [`Environment`](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-core.html#config-environment)
- `ELASTIC_APM_ENVIRONMENT`
- `OTEL_RESOURCE_ATTRIBUTES` value for `deployment.environment`
- defaults to agents current environment detection
- [`ServiceNodeName`](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-core.html#config-service-node-name)
- `ELASTIC_APM_SERVICE_NODE_NAME`
- `OTEL_RESOURCE_ATTRIBUTES` value for `service.instance.id`
- defaults to agents current environment detection
- [`LogLevel`](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-supportability.html#config-log-level)
- `ELASTIC_APM_LOG_LEVEL`
- `OTEL_LOG_LEVEL`
- defaults to `Error`.
We could later follow this up with a discussion on what other [resource semantic conventions](https://opentelemetry.io/docs/specs/otel/resource/semantic_conventions/) we could support in the future. As well as finding a way to map `OTEL_RESOURCE_ATTRIBUTES` to [`GlobalLabels`](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-core.html#config-global-labels) but leaving it out of scope for now.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.