Closed markfink-splunk closed 3 years ago
Could you try the daily build? I ran the example here: https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/examples/Console/TestOtlpExporter.cs
with
.SetResourceBuilder(
ResourceBuilder.CreateDefault()
.AddEnvironmentVariableDetector())
and the following as env variable: env=cijo,service.name=cartservice
My output is pasted below, which shows Resources populated as expected.
Resource labels:
-> telemetry.sdk.name: STRING(opentelemetry)
-> telemetry.sdk.language: STRING(dotnet)
-> telemetry.sdk.version: STRING(1.0.0.0)
-> env: STRING(cijo)
-> service.name: STRING(cartservice)
InstrumentationLibrarySpans #0
InstrumentationLibrary Samples.SampleServer
Span #0
Trace ID : 8256f4ddc87ef844b954edf975e3ca95
Parent ID : f04282da17fe6f44
ID : 61955aafdccf8841
Name : ReadStream
Kind : SPAN_KIND_CONSUMER
Start time : 2021-01-27 01:42:52.9067729 +0000 UTC
End time : 2021-01-27 01:42:52.9120235 +0000 UTC
Events:
SpanEvent #0
-> Name: StreamReader.ReadToEnd
-> Timestamp: 1611711772911302100
-> DroppedAttributesCount: 0
Span #1
Trace ID : 8256f4ddc87ef844b954edf975e3ca95
Parent ID :
ID : f04282da17fe6f44
Name : POST:/api/request/
Kind : SPAN_KIND_SERVER
Start time : 2021-01-27 01:42:52.8896798 +0000 UTC
End time : 2021-01-27 01:42:52.9287588 +0000 UTC
Attributes:
-> http.header.traceparent: STRING(00-1c8ecf589e866944932798713eafd2b9-6587a54dfd610e42-01)
-> http.header.Content-Length: STRING(36)
-> http.header.Content-Type: STRING(text/plain; charset=utf-8)
-> http.header.Host: STRING(localhost:19999)
-> request.content: STRING(client message: 1/26/2021 5:42:52 PM)
-> request.length: STRING(36)
@cijothomas Thank you sir. I wasn't aware of the nightly builds. I tried out the latest build and it worked fine.
Bug Report
OpenTelemetry 1.0.0-rc1.1
*
net5.0
*
Symptom
The above reads OTEL_RESOURCE_ATTRIBUTES and creates a resource attribute/label for service.name. But for anything else, it creates a span attribute. For instance...
OTEL_RESOURCE_ATTRIBUTES="service.name=cartservice,environment=hipster_shop"
This creates a resource attribute for service.name, but it creates a span attribute for environment. With all other languages (and I've tried them all now), OTEL_RESOURCE_ATTRIBUTES are always created as resource attributes.
What is the expected behavior?
OTEL_RESOURCE_ATTRIBUTES should be created as resource attributes, not span attributes.
What did you expect to see?
I expect to see this at the Otel Collector via the logging exporter:
What is the actual behavior?
This is what I'm actually seeing at the Otel Collector. See how service.name shows up under resource labels at top. "environment" is showing up, but that's coming from the Otel Collector (via resource processor), not OTEL_RESOURCE_ATTRIBUTES. Scroll down and you see the OTEL_RESOURCE_ATTRIBUTES environment value showing up under Attributes. That's the issue. So now I have a conflict between the resource label and the span attribute.