support standard OpenTelemetry envvars where appropriate
via @ahayworth, otel-cli should support the standard envvars that make sense
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md
Supporting more Otel Auto Configurer environment variables would be great.
Here are some environment variable that look particularly valuable when integrating the otel-cli with the Jenkins OpenTelemetry Plugin so that Jenkins pipeline sh steps could invoke the otel-cli transparently passing all the context and settings via environment variables:
| Environment variable | Value when used with the Jenkins OpenTelemetry Plugin | Comments |
|---|---|---|
OTEL_SERVICE_NAME |
Name of the service, default is "jenkins", can be customized in the Jenkins configuration | I'm not clear why the otel-cli preferred to use OTEL_CLI_SERVICE_NAME rather than OTEL_SERVICE_NAME |
OTEL_RESOURCE_ATTRIBUTES |
Attributes characterizing the Jenkins instance, primarily jenkins.url |
|
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS... |
Defined in the Jenkins config screen | Most of them seem to be already supported, see Otel Specs > OpenTelemetry Protocol Exporter |
With #35 merged I can finally start writing tests that validate envvar configs in a system test, so I'll be working on this in the next few days.
@cyrille-leclerc iirc I chose OTEL_CLI_SERVICE_NAME because I wasn't aware of the otel specs for envvars at that point.
I did some testing tricks in https://github.com/equinix-labs/otel-init-go/pull/2 that I will port over here so we can not only add the envvars but test that they're working right. That can come after the initial changes to align with the otel specs though.
Any updated on that?
@spuliaiev-sfdc as of PR #120 things should be in good shape. I'm not aware of any envvars that don't match the specs. There are also now tests in place that check the vars all the way through otel-cli to the server.
Please let me know if there's something important to you that's missing!
Am I missing the change to read OTEL_SERVICE_NAME when OTEL_CLI_SERVICE_NAME is not provided?
@spuliaiev-sfdc you're right, that needs fixed. I've started on #158.
This should be resolved as of v0.3.0. There's more opportunity to use service attribute autodetection but that's a topic for antoher issue. Please open a new issue for envvars you need that aren't supported yet.