fix tracing config

This commit is contained in:
Willy Kloucek committed 2022-01-13 08:13:14 +01:00
1 parent 060401a168
commit 182712b223
32 files changed
+177 -38

No files matched your search

+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+2 -2
View File
@@ -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)
}
}
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {
+3 -3
View File
@@ -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"`
+11
View File
@@ -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 {