handle OTEL_EXPORTER_OTLP_TRACES and fix unix endpoints #100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These fixes are needed to make otel-cli work with BuildKit after moby/buildkit#2572
The first commit adds support for
OTEL_EXPORTER_OTLP_TRACES_
variables for setting the trace endpoint. These are defined in https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md . These variables are defined more specifically so take priority over the generic vars if set.The second commit fixes unix URLs.
Unix URLs should not need any special handling but the current implementation handles values without the
schema that is not allowed by the spec.
From https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md
If this can be removed in the future then all these exceptions can be removed as well and
WithInsecure
is automatically detected by the endpoint value in
otlptracegrpc
package. https://github.com/open-telemetry/opentelemetry-go/blob/v1.3.0/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go#L166-L167Currently, it fails in your custom endpoint parsing regexps that don't expect such values. Although
otlptracegrpc
correctly marks it insecure by default it is overwritten by otel-cli because it always sets TLS credentials if it can't match endpoint to a loopback name. The correct fix in here would be just to only set TLS credentials if the schema ishttps
like the spec defines. Everything else is handled automatically byotlptracegrpc
. But I didn't want to break any backward compatibility here so leave that for future development/discussion.