Add Tracing Header Context Name option for Jaeger
This commit is contained in:
parent
f0ee2890b2
commit
156f6b8d3c
17 changed files with 327 additions and 49 deletions
27
vendor/github.com/uber/jaeger-client-go/config/config_env.go
generated
vendored
27
vendor/github.com/uber/jaeger-client-go/config/config_env.go
generated
vendored
|
@ -16,6 +16,7 @@ package config
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -41,6 +42,9 @@ const (
|
|||
envReporterMaxQueueSize = "JAEGER_REPORTER_MAX_QUEUE_SIZE"
|
||||
envReporterFlushInterval = "JAEGER_REPORTER_FLUSH_INTERVAL"
|
||||
envReporterLogSpans = "JAEGER_REPORTER_LOG_SPANS"
|
||||
envEndpoint = "JAEGER_ENDPOINT"
|
||||
envUser = "JAEGER_USER"
|
||||
envPassword = "JAEGER_PASSWORD"
|
||||
envAgentHost = "JAEGER_AGENT_HOST"
|
||||
envAgentPort = "JAEGER_AGENT_PORT"
|
||||
)
|
||||
|
@ -156,12 +160,19 @@ func reporterConfigFromEnv() (*ReporterConfig, error) {
|
|||
}
|
||||
|
||||
host := jaeger.DefaultUDPSpanServerHost
|
||||
ep := os.Getenv(envEndpoint)
|
||||
if e := os.Getenv(envAgentHost); e != "" {
|
||||
if ep != "" {
|
||||
return nil, errors.Errorf("cannot set env vars %s and %s together", envAgentHost, envEndpoint)
|
||||
}
|
||||
host = e
|
||||
}
|
||||
|
||||
port := jaeger.DefaultUDPSpanServerPort
|
||||
if e := os.Getenv(envAgentPort); e != "" {
|
||||
if ep != "" {
|
||||
return nil, errors.Errorf("cannot set env vars %s and %s together", envAgentPort, envEndpoint)
|
||||
}
|
||||
if value, err := strconv.ParseInt(e, 10, 0); err == nil {
|
||||
port = int(value)
|
||||
} else {
|
||||
|
@ -173,6 +184,22 @@ func reporterConfigFromEnv() (*ReporterConfig, error) {
|
|||
// were not explicitly passed
|
||||
rc.LocalAgentHostPort = fmt.Sprintf("%s:%d", host, port)
|
||||
|
||||
if ep != "" {
|
||||
u, err := url.ParseRequestURI(ep)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot parse env var %s=%s", envEndpoint, ep)
|
||||
}
|
||||
rc.CollectorEndpoint = fmt.Sprintf("%s", u)
|
||||
}
|
||||
|
||||
user := os.Getenv(envUser)
|
||||
pswd := os.Getenv(envPassword)
|
||||
if user != "" && pswd == "" || user == "" && pswd != "" {
|
||||
return nil, errors.Errorf("you must set %s and %s env vars together", envUser, envPassword)
|
||||
}
|
||||
rc.User = user
|
||||
rc.Password = pswd
|
||||
|
||||
return rc, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue