only configure tracing in envoy if it is enabled in pomerium

This commit is contained in:
Joe Kralicky 2025-01-06 18:59:42 +00:00
parent 180c7e04af
commit de68673819
No known key found for this signature in database
GPG key ID: 75C4875F34A9FB79
3 changed files with 50 additions and 10 deletions

View file

@ -225,3 +225,35 @@ func (n NoopClient) Stop(context.Context) error {
func (n NoopClient) UploadTraces(context.Context, []*v1.ResourceSpans) error {
return nil
}
func IsDisabledViaEnvironment() bool {
if os.Getenv("OTEL_SDK_DISABLED") == "true" {
return true
}
exporter, ok := os.LookupEnv("OTEL_TRACES_EXPORTER")
if !ok {
return false
}
switch strings.ToLower(strings.TrimSpace(exporter)) {
case "none, noop":
return true
default:
return false
}
}
func IsEnabledViaEnvironment() bool {
if os.Getenv("OTEL_SDK_DISABLED") == "true" {
return false
}
exporter, ok := os.LookupEnv("OTEL_TRACES_EXPORTER")
if !ok {
return false
}
switch strings.ToLower(strings.TrimSpace(exporter)) {
case "none, noop", "":
return false
default:
return true
}
}