mirror of https://github.com/docker/cli.git
Fix OTLP env var overriding
Signed-off-by: Christopher Petito <chrisjpetito@gmail.com>
This commit is contained in:
parent
c0cc22db58
commit
d6796c002f
|
@ -41,24 +41,20 @@ func dockerExporterOTLPEndpoint(cli Cli) (endpoint string, secure bool) {
|
||||||
otelCfg = m[otelContextFieldName]
|
otelCfg = m[otelContextFieldName]
|
||||||
}
|
}
|
||||||
|
|
||||||
if otelCfg == nil {
|
if otelCfg != nil {
|
||||||
return "", false
|
otelMap, ok := otelCfg.(map[string]any)
|
||||||
|
if !ok {
|
||||||
|
otel.Handle(errors.Errorf(
|
||||||
|
"unexpected type for field %q: %T (expected: %T)",
|
||||||
|
otelContextFieldName,
|
||||||
|
otelCfg,
|
||||||
|
otelMap,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
// keys from https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/
|
||||||
|
endpoint, _ = otelMap[otelExporterOTLPEndpoint].(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
otelMap, ok := otelCfg.(map[string]any)
|
|
||||||
if !ok {
|
|
||||||
otel.Handle(errors.Errorf(
|
|
||||||
"unexpected type for field %q: %T (expected: %T)",
|
|
||||||
otelContextFieldName,
|
|
||||||
otelCfg,
|
|
||||||
otelMap,
|
|
||||||
))
|
|
||||||
return "", false
|
|
||||||
}
|
|
||||||
|
|
||||||
// keys from https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/
|
|
||||||
endpoint, _ = otelMap[otelExporterOTLPEndpoint].(string)
|
|
||||||
|
|
||||||
// Override with env var value if it exists AND IS SET
|
// Override with env var value if it exists AND IS SET
|
||||||
// (ignore otel defaults for this override when the key exists but is empty)
|
// (ignore otel defaults for this override when the key exists but is empty)
|
||||||
if override := os.Getenv(debugEnvVarPrefix + otelExporterOTLPEndpoint); override != "" {
|
if override := os.Getenv(debugEnvVarPrefix + otelExporterOTLPEndpoint); override != "" {
|
||||||
|
|
Loading…
Reference in New Issue