From 182712b22364a2d01ea80ff61ca6b77d7faff9e6 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Wed, 12 Jan 2022 10:24:59 +0100 Subject: [PATCH] fix tracing config --- accounts/pkg/config/config.go | 6 +++--- accounts/pkg/config/parser/parse.go | 11 +++++++++++ .../monitoring_tracing/docker-compose-additions.yml | 1 + .../monitoring_tracing/docker-compose-additions.yml | 1 + .../monitoring_tracing/docker-compose-additions.yml | 1 + .../monitoring_tracing/docker-compose-additions.yml | 1 + .../monitoring_tracing/docker-compose-additions.yml | 1 + .../monitoring_tracing/docker-compose-additions.yml | 1 + .../monitoring_tracing/docker-compose-additions.yml | 1 + glauth/pkg/config/config.go | 6 +++--- glauth/pkg/config/parser/parse.go | 11 +++++++++++ graph-explorer/pkg/config/config.go | 6 +++--- graph-explorer/pkg/config/parser/parse.go | 11 +++++++++++ graph/pkg/config/config.go | 6 +++--- graph/pkg/config/parser/parse.go | 11 +++++++++++ idp/pkg/config/config.go | 6 +++--- idp/pkg/config/parser/parse.go | 11 +++++++++++ ocis-pkg/tracing/tracing.go | 4 ++-- ocs/pkg/config/config.go | 6 +++--- ocs/pkg/config/parser/parse.go | 11 +++++++++++ proxy/pkg/config/config.go | 6 +++--- proxy/pkg/config/parser/parse.go | 11 +++++++++++ settings/pkg/config/config.go | 6 +++--- settings/pkg/config/parser/parse.go | 11 +++++++++++ store/pkg/config/config.go | 6 +++--- store/pkg/config/parser/parse.go | 11 +++++++++++ thumbnails/pkg/config/config.go | 6 +++--- thumbnails/pkg/config/parser/parse.go | 11 +++++++++++ web/pkg/config/config.go | 6 +++--- web/pkg/config/parser/parse.go | 11 +++++++++++ webdav/pkg/config/config.go | 6 +++--- webdav/pkg/config/parser/parse.go | 11 +++++++++++ 32 files changed, 177 insertions(+), 38 deletions(-) diff --git a/accounts/pkg/config/config.go b/accounts/pkg/config/config.go index e21073616..305fa5e21 100644 --- a/accounts/pkg/config/config.go +++ b/accounts/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` GRPC GRPC `ocisConfig:"grpc"` diff --git a/accounts/pkg/config/parser/parse.go b/accounts/pkg/config/parser/parse.go index dee2dc13b..92cba79b5 100644 --- a/accounts/pkg/config/parser/parse.go +++ b/accounts/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/deployments/examples/oc10_ocis_parallel/monitoring_tracing/docker-compose-additions.yml b/deployments/examples/oc10_ocis_parallel/monitoring_tracing/docker-compose-additions.yml index a077eda65..8abdf4e83 100644 --- a/deployments/examples/oc10_ocis_parallel/monitoring_tracing/docker-compose-additions.yml +++ b/deployments/examples/oc10_ocis_parallel/monitoring_tracing/docker-compose-additions.yml @@ -6,6 +6,7 @@ services: environment: # tracing OCIS_TRACING_ENABLED: "true" + OCIS_TRACING_TYPE: "jaeger" OCIS_TRACING_ENDPOINT: jaeger-agent:6831 # metrics APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165 diff --git a/deployments/examples/ocis_hello/monitoring_tracing/docker-compose-additions.yml b/deployments/examples/ocis_hello/monitoring_tracing/docker-compose-additions.yml index a077eda65..8abdf4e83 100644 --- a/deployments/examples/ocis_hello/monitoring_tracing/docker-compose-additions.yml +++ b/deployments/examples/ocis_hello/monitoring_tracing/docker-compose-additions.yml @@ -6,6 +6,7 @@ services: environment: # tracing OCIS_TRACING_ENABLED: "true" + OCIS_TRACING_TYPE: "jaeger" OCIS_TRACING_ENDPOINT: jaeger-agent:6831 # metrics APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165 diff --git a/deployments/examples/ocis_keycloak/monitoring_tracing/docker-compose-additions.yml b/deployments/examples/ocis_keycloak/monitoring_tracing/docker-compose-additions.yml index a077eda65..8abdf4e83 100644 --- a/deployments/examples/ocis_keycloak/monitoring_tracing/docker-compose-additions.yml +++ b/deployments/examples/ocis_keycloak/monitoring_tracing/docker-compose-additions.yml @@ -6,6 +6,7 @@ services: environment: # tracing OCIS_TRACING_ENABLED: "true" + OCIS_TRACING_TYPE: "jaeger" OCIS_TRACING_ENDPOINT: jaeger-agent:6831 # metrics APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165 diff --git a/deployments/examples/ocis_ldap/monitoring_tracing/docker-compose-additions.yml b/deployments/examples/ocis_ldap/monitoring_tracing/docker-compose-additions.yml index a077eda65..8abdf4e83 100644 --- a/deployments/examples/ocis_ldap/monitoring_tracing/docker-compose-additions.yml +++ b/deployments/examples/ocis_ldap/monitoring_tracing/docker-compose-additions.yml @@ -6,6 +6,7 @@ services: environment: # tracing OCIS_TRACING_ENABLED: "true" + OCIS_TRACING_TYPE: "jaeger" OCIS_TRACING_ENDPOINT: jaeger-agent:6831 # metrics APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165 diff --git a/deployments/examples/ocis_s3/monitoring_tracing/docker-compose-additions.yml b/deployments/examples/ocis_s3/monitoring_tracing/docker-compose-additions.yml index a077eda65..8abdf4e83 100644 --- a/deployments/examples/ocis_s3/monitoring_tracing/docker-compose-additions.yml +++ b/deployments/examples/ocis_s3/monitoring_tracing/docker-compose-additions.yml @@ -6,6 +6,7 @@ services: environment: # tracing OCIS_TRACING_ENABLED: "true" + OCIS_TRACING_TYPE: "jaeger" OCIS_TRACING_ENDPOINT: jaeger-agent:6831 # metrics APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165 diff --git a/deployments/examples/ocis_traefik/monitoring_tracing/docker-compose-additions.yml b/deployments/examples/ocis_traefik/monitoring_tracing/docker-compose-additions.yml index a077eda65..8abdf4e83 100644 --- a/deployments/examples/ocis_traefik/monitoring_tracing/docker-compose-additions.yml +++ b/deployments/examples/ocis_traefik/monitoring_tracing/docker-compose-additions.yml @@ -6,6 +6,7 @@ services: environment: # tracing OCIS_TRACING_ENABLED: "true" + OCIS_TRACING_TYPE: "jaeger" OCIS_TRACING_ENDPOINT: jaeger-agent:6831 # metrics APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165 diff --git a/deployments/examples/ocis_wopi/monitoring_tracing/docker-compose-additions.yml b/deployments/examples/ocis_wopi/monitoring_tracing/docker-compose-additions.yml index a077eda65..8abdf4e83 100644 --- a/deployments/examples/ocis_wopi/monitoring_tracing/docker-compose-additions.yml +++ b/deployments/examples/ocis_wopi/monitoring_tracing/docker-compose-additions.yml @@ -6,6 +6,7 @@ services: environment: # tracing OCIS_TRACING_ENABLED: "true" + OCIS_TRACING_TYPE: "jaeger" OCIS_TRACING_ENDPOINT: jaeger-agent:6831 # metrics APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165 diff --git a/glauth/pkg/config/config.go b/glauth/pkg/config/config.go index 3d687319c..7de14cf68 100644 --- a/glauth/pkg/config/config.go +++ b/glauth/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` Ldap Ldap `ocisConfig:"ldap"` Ldaps Ldaps `ocisConfig:"ldaps"` diff --git a/glauth/pkg/config/parser/parse.go b/glauth/pkg/config/parser/parse.go index b2a18b2a9..540bf80d3 100644 --- a/glauth/pkg/config/parser/parse.go +++ b/glauth/pkg/config/parser/parse.go @@ -27,6 +27,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/graph-explorer/pkg/config/config.go b/graph-explorer/pkg/config/config.go index d84c239fd..2d70fd664 100644 --- a/graph-explorer/pkg/config/config.go +++ b/graph-explorer/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` diff --git a/graph-explorer/pkg/config/parser/parse.go b/graph-explorer/pkg/config/parser/parse.go index be113e459..cb463eecf 100644 --- a/graph-explorer/pkg/config/parser/parse.go +++ b/graph-explorer/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/graph/pkg/config/config.go b/graph/pkg/config/config.go index 523bcfdb0..d094cf54f 100644 --- a/graph/pkg/config/config.go +++ b/graph/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` diff --git a/graph/pkg/config/parser/parse.go b/graph/pkg/config/parser/parse.go index 885682154..bfb1302bb 100644 --- a/graph/pkg/config/parser/parse.go +++ b/graph/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/idp/pkg/config/config.go b/idp/pkg/config/config.go index 7c16b9b1b..4e5e4b0d1 100644 --- a/idp/pkg/config/config.go +++ b/idp/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` diff --git a/idp/pkg/config/parser/parse.go b/idp/pkg/config/parser/parse.go index de98f42d6..faa1ea166 100644 --- a/idp/pkg/config/parser/parse.go +++ b/idp/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/ocis-pkg/tracing/tracing.go b/ocis-pkg/tracing/tracing.go index f12664b9d..7d76e6352 100644 --- a/ocis-pkg/tracing/tracing.go +++ b/ocis-pkg/tracing/tracing.go @@ -21,7 +21,7 @@ var Propagator = propagation.NewCompositeTextMapPropagator( // GetTraceProvider returns a configured open-telemetry trace provider. func GetTraceProvider(agentEndpoint, collectorEndpoint, serviceName, traceType string) (*sdktrace.TracerProvider, error) { switch t := traceType; t { - case "jaeger": + case "", "jaeger": var ( exp *jaeger.Exporter err error @@ -66,7 +66,7 @@ func GetTraceProvider(agentEndpoint, collectorEndpoint, serviceName, traceType s case "zipkin": fallthrough default: - return nil, fmt.Errorf("invalid trace configuration") + return nil, fmt.Errorf("unknown trace type %s", traceType) } } diff --git a/ocs/pkg/config/config.go b/ocs/pkg/config/config.go index bfad75d86..2c9693adc 100644 --- a/ocs/pkg/config/config.go +++ b/ocs/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` diff --git a/ocs/pkg/config/parser/parse.go b/ocs/pkg/config/parser/parse.go index 9a50e535b..48f8e51a2 100644 --- a/ocs/pkg/config/parser/parse.go +++ b/ocs/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/proxy/pkg/config/config.go b/proxy/pkg/config/config.go index c525421e8..277b7dff2 100644 --- a/proxy/pkg/config/config.go +++ b/proxy/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` diff --git a/proxy/pkg/config/parser/parse.go b/proxy/pkg/config/parser/parse.go index 65921b31c..493ed0bca 100644 --- a/proxy/pkg/config/parser/parse.go +++ b/proxy/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/settings/pkg/config/config.go b/settings/pkg/config/config.go index fce3b34d5..8e9e5f1ef 100644 --- a/settings/pkg/config/config.go +++ b/settings/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` GRPC GRPC `ocisConfig:"grpc"` diff --git a/settings/pkg/config/parser/parse.go b/settings/pkg/config/parser/parse.go index 551d44108..5ceb37a1f 100644 --- a/settings/pkg/config/parser/parse.go +++ b/settings/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/store/pkg/config/config.go b/store/pkg/config/config.go index 46855d55d..585fd7424 100644 --- a/store/pkg/config/config.go +++ b/store/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` GRPC GRPC `ocisConfig:"grpc"` diff --git a/store/pkg/config/parser/parse.go b/store/pkg/config/parser/parse.go index f3789eecb..29e2efa29 100644 --- a/store/pkg/config/parser/parse.go +++ b/store/pkg/config/parser/parse.go @@ -27,6 +27,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/thumbnails/pkg/config/config.go b/thumbnails/pkg/config/config.go index 8ab2d5bfd..527f94a50 100644 --- a/thumbnails/pkg/config/config.go +++ b/thumbnails/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` GRPC GRPC `ocisConfig:"grpc"` diff --git a/thumbnails/pkg/config/parser/parse.go b/thumbnails/pkg/config/parser/parse.go index 3591aea8a..e621f53d0 100644 --- a/thumbnails/pkg/config/parser/parse.go +++ b/thumbnails/pkg/config/parser/parse.go @@ -27,6 +27,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/web/pkg/config/config.go b/web/pkg/config/config.go index 13f67adfe..d403136e1 100644 --- a/web/pkg/config/config.go +++ b/web/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` diff --git a/web/pkg/config/parser/parse.go b/web/pkg/config/parser/parse.go index 71870c8ce..766c4d6e8 100644 --- a/web/pkg/config/parser/parse.go +++ b/web/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil { diff --git a/webdav/pkg/config/config.go b/webdav/pkg/config/config.go index 7c48724c2..04fb193e5 100644 --- a/webdav/pkg/config/config.go +++ b/webdav/pkg/config/config.go @@ -12,9 +12,9 @@ type Config struct { Service Service - Tracing Tracing `ocisConfig:"tracing"` - Log *Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` + Tracing *Tracing `ocisConfig:"tracing"` + Log *Log `ocisConfig:"log"` + Debug Debug `ocisConfig:"debug"` HTTP HTTP `ocisConfig:"http"` diff --git a/webdav/pkg/config/parser/parse.go b/webdav/pkg/config/parser/parse.go index 66341b099..e6e0246af 100644 --- a/webdav/pkg/config/parser/parse.go +++ b/webdav/pkg/config/parser/parse.go @@ -28,6 +28,17 @@ func ParseConfig(cfg *config.Config) error { } else if cfg.Log == nil && cfg.Commons == nil { cfg.Log = &config.Log{} } + // provide with defaults for shared tracing, since we need a valid destination address for BindEnv. + if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil { + cfg.Tracing = &config.Tracing{ + Enabled: cfg.Commons.Tracing.Enabled, + Type: cfg.Commons.Tracing.Type, + Endpoint: cfg.Commons.Tracing.Endpoint, + Collector: cfg.Commons.Tracing.Collector, + } + } else if cfg.Tracing == nil && cfg.Commons == nil { + cfg.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil {