Tracing: Allow otel service name and attributes to be overridden from env (#85937)

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
Marcus Efraimsson
2024-04-11 15:18:46 +02:00
committed by GitHub
parent 0d42e025f0
commit 78f460c4de
2 changed files with 2 additions and 1 deletions

View File

@@ -1925,7 +1925,7 @@ Configure general parameters shared between OpenTelemetry providers.
Comma-separated list of attributes to include in all new spans, such as `key1:value1,key2:value2`. Comma-separated list of attributes to include in all new spans, such as `key1:value1,key2:value2`.
Can be set with the environment variable `OTEL_RESOURCE_ATTRIBUTES` (use `=` instead of `:` with the environment variable). Can be set or overridden with the environment variable `OTEL_RESOURCE_ATTRIBUTES` (use `=` instead of `:` with the environment variable). The service name can be set or overridden using attributes or with the environment variable `OTEL_SERVICE_NAME`.
### sampler_type ### sampler_type

View File

@@ -209,6 +209,7 @@ func initTracerProvider(exp tracesdk.SpanExporter, serviceName string, serviceVe
semconv.ServiceVersionKey.String(serviceVersion), semconv.ServiceVersionKey.String(serviceVersion),
), ),
resource.WithAttributes(customAttribs...), resource.WithAttributes(customAttribs...),
resource.WithFromEnv(),
resource.WithProcessRuntimeDescription(), resource.WithProcessRuntimeDescription(),
resource.WithTelemetrySDK(), resource.WithTelemetrySDK(),
) )