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..fb801aed28 100644 --- a/accounts/pkg/config/parser/parse.go +++ b/accounts/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/changelog/unreleased/fix-tracing-config.md b/changelog/unreleased/fix-tracing-config.md new file mode 100644 index 0000000000..62b15cf6ab --- /dev/null +++ b/changelog/unreleased/fix-tracing-config.md @@ -0,0 +1,6 @@ +Bugfix: Fix the default tracing provider + +We've fixed the default tracing provider which was no longer configured after [owncloud/ocis#2818](https://github.com/owncloud/ocis/pull/2818). + +https://github.com/owncloud/ocis/pull/2952 +https://github.com/owncloud/ocis/pull/2818 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/defaultconfig.go b/glauth/pkg/config/defaultconfig.go index becff0bb9d..503321d8ee 100644 --- a/glauth/pkg/config/defaultconfig.go +++ b/glauth/pkg/config/defaultconfig.go @@ -11,12 +11,6 @@ func DefaultConfig() *Config { Debug: Debug{ Addr: "127.0.0.1:9129", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, Service: Service{ Name: "glauth", }, diff --git a/glauth/pkg/config/parser/parse.go b/glauth/pkg/config/parser/parse.go index b2a18b2a90..de91a18232 100644 --- a/glauth/pkg/config/parser/parse.go +++ b/glauth/pkg/config/parser/parse.go @@ -24,9 +24,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/defaultconfig.go b/graph-explorer/pkg/config/defaultconfig.go index 7ea4908193..454cb239a6 100644 --- a/graph-explorer/pkg/config/defaultconfig.go +++ b/graph-explorer/pkg/config/defaultconfig.go @@ -16,12 +16,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "graph-explorer", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, GraphExplorer: GraphExplorer{ ClientID: "ocis-explorer.js", Issuer: "https://localhost:9200", diff --git a/graph-explorer/pkg/config/parser/parse.go b/graph-explorer/pkg/config/parser/parse.go index be113e4598..c9127c292f 100644 --- a/graph-explorer/pkg/config/parser/parse.go +++ b/graph-explorer/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/defaultconfig.go b/graph/pkg/config/defaultconfig.go index 5879b9487a..3bb022786e 100644 --- a/graph/pkg/config/defaultconfig.go +++ b/graph/pkg/config/defaultconfig.go @@ -14,12 +14,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "graph", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, Reva: Reva{ Address: "127.0.0.1:9142", }, diff --git a/graph/pkg/config/parser/parse.go b/graph/pkg/config/parser/parse.go index 8856821543..367089f852 100644 --- a/graph/pkg/config/parser/parse.go +++ b/graph/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/defaultconfig.go b/idp/pkg/config/defaultconfig.go index 21e59a3391..823291596b 100644 --- a/idp/pkg/config/defaultconfig.go +++ b/idp/pkg/config/defaultconfig.go @@ -22,12 +22,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "idp", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, Asset: Asset{}, IDP: Settings{ Iss: "https://localhost:9200", diff --git a/idp/pkg/config/parser/parse.go b/idp/pkg/config/parser/parse.go index de98f42d68..d5561337e5 100644 --- a/idp/pkg/config/parser/parse.go +++ b/idp/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/config/parser/parse.go b/ocis-pkg/config/parser/parse.go index a0870d17c7..ba75a411c0 100644 --- a/ocis-pkg/config/parser/parse.go +++ b/ocis-pkg/config/parser/parse.go @@ -23,7 +23,7 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == nil { cfg.Log = &shared.Log{} } 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/defaultconfig.go b/ocs/pkg/config/defaultconfig.go index 59cbfb8f1f..0ed8378ba4 100644 --- a/ocs/pkg/config/defaultconfig.go +++ b/ocs/pkg/config/defaultconfig.go @@ -22,12 +22,7 @@ func DefaultConfig() *Config { Service: Service{ Name: "ocs", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, + TokenManager: TokenManager{ JWTSecret: "Pive-Fumkiu4", }, diff --git a/ocs/pkg/config/parser/parse.go b/ocs/pkg/config/parser/parse.go index 9a50e535b3..96f4205dfc 100644 --- a/ocs/pkg/config/parser/parse.go +++ b/ocs/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/defaultconfig.go b/proxy/pkg/config/defaultconfig.go index 136cf28b98..12bcbe806d 100644 --- a/proxy/pkg/config/defaultconfig.go +++ b/proxy/pkg/config/defaultconfig.go @@ -23,12 +23,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "proxy", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, OIDC: OIDC{ Issuer: "https://localhost:9200", Insecure: true, diff --git a/proxy/pkg/config/parser/parse.go b/proxy/pkg/config/parser/parse.go index 65921b31cf..55105cfcbc 100644 --- a/proxy/pkg/config/parser/parse.go +++ b/proxy/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/proxy/proxy_integration_test.go b/proxy/pkg/proxy/proxy_integration_test.go index 0137b4413e..1491933ad4 100644 --- a/proxy/pkg/proxy/proxy_integration_test.go +++ b/proxy/pkg/proxy/proxy_integration_test.go @@ -216,7 +216,7 @@ func testConfig(policy []config.Policy) *config.Config { Log: &config.Log{}, Debug: config.Debug{}, HTTP: config.HTTP{}, - Tracing: config.Tracing{}, + Tracing: &config.Tracing{}, Policies: policy, OIDC: config.OIDC{}, PolicySelector: 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/defaultconfig.go b/settings/pkg/config/defaultconfig.go index a667c0c251..7f72e50a30 100644 --- a/settings/pkg/config/defaultconfig.go +++ b/settings/pkg/config/defaultconfig.go @@ -33,12 +33,6 @@ func DefaultConfig() *Config { Addr: "127.0.0.1:9191", Namespace: "com.owncloud.api", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, DataPath: path.Join(defaults.BaseDataPath(), "settings"), Asset: Asset{ Path: "", diff --git a/settings/pkg/config/parser/parse.go b/settings/pkg/config/parser/parse.go index 551d44108c..f1c7c94362 100644 --- a/settings/pkg/config/parser/parse.go +++ b/settings/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/storage/pkg/command/gateway.go b/storage/pkg/command/gateway.go index 0de42d2b91..b3a3cf4828 100644 --- a/storage/pkg/command/gateway.go +++ b/storage/pkg/command/gateway.go @@ -423,7 +423,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config, storageExtension string) er Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == nil { cfg.Log = &shared.Log{} } 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/defaultconfig.go b/store/pkg/config/defaultconfig.go index 66e44044d3..c2d42f4301 100644 --- a/store/pkg/config/defaultconfig.go +++ b/store/pkg/config/defaultconfig.go @@ -21,12 +21,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "store", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, Datapath: path.Join(defaults.BaseDataPath(), "store"), } } diff --git a/store/pkg/config/parser/parse.go b/store/pkg/config/parser/parse.go index f3789eecbf..a0f532c9e1 100644 --- a/store/pkg/config/parser/parse.go +++ b/store/pkg/config/parser/parse.go @@ -24,9 +24,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/defaultconfig.go b/thumbnails/pkg/config/defaultconfig.go index ac2da94d29..8f59db53e3 100644 --- a/thumbnails/pkg/config/defaultconfig.go +++ b/thumbnails/pkg/config/defaultconfig.go @@ -21,12 +21,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "thumbnails", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, Thumbnail: Thumbnail{ Resolutions: []string{"16x16", "32x32", "64x64", "128x128", "1920x1080", "3840x2160", "7680x4320"}, FileSystemStorage: FileSystemStorage{ diff --git a/thumbnails/pkg/config/parser/parse.go b/thumbnails/pkg/config/parser/parse.go index 3591aea8a5..5fa62fb15e 100644 --- a/thumbnails/pkg/config/parser/parse.go +++ b/thumbnails/pkg/config/parser/parse.go @@ -24,9 +24,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/defaultconfig.go b/web/pkg/config/defaultconfig.go index 42f22beda3..018cac2d0a 100644 --- a/web/pkg/config/defaultconfig.go +++ b/web/pkg/config/defaultconfig.go @@ -17,12 +17,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "web", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, Asset: Asset{ Path: "", }, diff --git a/web/pkg/config/parser/parse.go b/web/pkg/config/parser/parse.go index 71870c8ce6..2151f613e4 100644 --- a/web/pkg/config/parser/parse.go +++ b/web/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.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/defaultconfig.go b/webdav/pkg/config/defaultconfig.go index dcd3c04f9e..3bf74acd25 100644 --- a/webdav/pkg/config/defaultconfig.go +++ b/webdav/pkg/config/defaultconfig.go @@ -22,12 +22,6 @@ func DefaultConfig() *Config { Service: Service{ Name: "webdav", }, - Tracing: Tracing{ - Enabled: false, - Type: "jaeger", - Endpoint: "", - Collector: "", - }, OcisPublicURL: "https://127.0.0.1:9200", WebdavNamespace: "/users/{{.Id.OpaqueId}}", RevaGateway: "127.0.0.1:9142", diff --git a/webdav/pkg/config/parser/parse.go b/webdav/pkg/config/parser/parse.go index 66341b0992..33c893db4a 100644 --- a/webdav/pkg/config/parser/parse.go +++ b/webdav/pkg/config/parser/parse.go @@ -25,9 +25,20 @@ func ParseConfig(cfg *config.Config) error { Color: cfg.Commons.Log.Color, File: cfg.Commons.Log.File, } - } else if cfg.Log == nil && cfg.Commons == nil { + } else if cfg.Log == 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.Tracing = &config.Tracing{} + } // load all env variables relevant to the config in the current context. if err := envdecode.Decode(cfg); err != nil {