diff --git a/accounts/pkg/config/config.go b/accounts/pkg/config/config.go index e210736161..305fa5e219 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 dee2dc13b7..92cba79b5f 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 a077eda65d..8abdf4e838 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 a077eda65d..8abdf4e838 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 a077eda65d..8abdf4e838 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 a077eda65d..8abdf4e838 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 a077eda65d..8abdf4e838 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 a077eda65d..8abdf4e838 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 a077eda65d..8abdf4e838 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 3d687319cd..7de14cf687 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 b2a18b2a90..540bf80d3e 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 d84c239fde..2d70fd664a 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 be113e4598..cb463eecf8 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 523bcfdb04..d094cf54f9 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 8856821543..bfb1302bbf 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 7c16b9b1bf..4e5e4b0d13 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 de98f42d68..faa1ea1665 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 f12664b9dd..7d76e63524 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 bfad75d860..2c9693adca 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 9a50e535b3..48f8e51a2d 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 c525421e80..277b7dff2d 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 65921b31cf..493ed0bca6 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 fce3b34d5f..8e9e5f1eff 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 551d44108c..5ceb37a1ff 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 46855d55da..585fd7424a 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 f3789eecbf..29e2efa292 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 8ab2d5bfd2..527f94a50e 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 3591aea8a5..e621f53d07 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 13f67adfef..d403136e18 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 71870c8ce6..766c4d6e81 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 7c48724c22..04fb193e56 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 66341b0992..e6e0246aff 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 {