-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathenvvars.go
49 lines (44 loc) · 1.88 KB
/
envvars.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2023 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0
package jaegerclientenv2otel
import (
"os"
"go.uber.org/zap"
)
var envVars = map[string]string{
"JAEGER_SERVICE_NAME": "",
"JAEGER_AGENT_HOST": "OTEL_EXPORTER_JAEGER_AGENT_HOST",
"JAEGER_AGENT_PORT": "OTEL_EXPORTER_JAEGER_AGENT_PORT",
"JAEGER_ENDPOINT": "OTEL_EXPORTER_JAEGER_ENDPOINT",
"JAEGER_USER": "OTEL_EXPORTER_JAEGER_USER",
"JAEGER_PASSWORD": "OTEL_EXPORTER_JAEGER_PASSWORD",
"JAEGER_REPORTER_LOG_SPANS": "",
"JAEGER_REPORTER_MAX_QUEUE_SIZE": "",
"JAEGER_REPORTER_FLUSH_INTERVAL": "",
"JAEGER_REPORTER_ATTEMPT_RECONNECTING_DISABLED": "",
"JAEGER_REPORTER_ATTEMPT_RECONNECT_INTERVAL": "",
"JAEGER_SAMPLER_TYPE": "",
"JAEGER_SAMPLER_PARAM": "",
"JAEGER_SAMPLER_MANAGER_HOST_PORT": "",
"JAEGER_SAMPLING_ENDPOINT": "",
"JAEGER_SAMPLER_MAX_OPERATIONS": "",
"JAEGER_SAMPLER_REFRESH_INTERVAL": "",
"JAEGER_TAGS": "",
"JAEGER_TRACEID_128BIT": "",
"JAEGER_DISABLED": "",
"JAEGER_RPC_METRICS": "",
}
func MapJaegerToOtelEnvVars(logger *zap.Logger) {
for jname, otelname := range envVars {
val := os.Getenv(jname)
if val == "" {
continue
}
if otelname == "" {
logger.Sugar().Infof("Ignoring deprecated Jaeger SDK env var %s, as there is no equivalent in OpenTelemetry", jname)
} else {
os.Setenv(otelname, val)
logger.Sugar().Infof("Replacing deprecated Jaeger SDK env var %s with OpenTelemetry env var %s", jname, otelname)
}
}
}