mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
feat: add env vars to control otel
This commit is contained in:
parent
50520b9abb
commit
e6ecec93a4
@ -31,7 +31,7 @@ type (
|
||||
|
||||
func ClientWithOtelEnabled(v bool) ClientOption {
|
||||
return func(o *ClientOptions) {
|
||||
o.OtelEnabled = env.GetBool("OTEL_ENABLED", v)
|
||||
o.OtelEnabled = v
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ func DefaultClientOptions() ClientOptions {
|
||||
Logger: log.Logger(),
|
||||
Namespace: "default",
|
||||
RegisterNamespace: nil,
|
||||
OtelEnabled: env.GetBool("OTEL_ENABLED", false),
|
||||
OtelEnabled: env.GetBool("TEMPORAL_OTEL_ENABLED", env.GetBool("OTEL_ENABLED", false)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -56,8 +56,10 @@ func WithDatabaseOptions(v *options.DatabaseOptions) Option {
|
||||
|
||||
func DefaultOptions() Options {
|
||||
return Options{
|
||||
OtelEnabled: env.GetBool("OTEL_ENABLED", false),
|
||||
OtelOptions: nil,
|
||||
OtelEnabled: env.GetBool("MONGO_OTEL_ENABLED", env.GetBool("OTEL_ENABLED", false)),
|
||||
OtelOptions: []otelmongo.Option{
|
||||
otelmongo.WithCommandAttributeDisabled(env.GetBool("OTEL_MONGO_COMMAND_ATTRIBUTE_DISABLED", false)),
|
||||
},
|
||||
ClientOptions: options.Client().
|
||||
SetReadConcern(readconcern.Majority()).
|
||||
SetWriteConcern(writeconcern.New(writeconcern.WMajority())),
|
||||
|
||||
@ -83,7 +83,7 @@ func newTracerProvider(e sdktrace.SpanExporter) (trace.TracerProvider, error) {
|
||||
tracerProvider := sdktrace.NewTracerProvider(
|
||||
sdktrace.WithBatcher(e),
|
||||
sdktrace.WithResource(resource),
|
||||
sdktrace.WithSampler(sdktrace.AlwaysSample()),
|
||||
sdktrace.WithSampler(sdktrace.TraceIDRatioBased(env.GetFloat64("OTEL_TRACE_RATIO", 1))),
|
||||
)
|
||||
|
||||
otel.SetTracerProvider(tracerProvider)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user