Open mribeiro-clearsale opened 3 months ago
Thanks for the detailed explanation.
I think the issue could be because the OTEL_SERVICE_NAME
environment variable value is not correctly parsed in the .NET application builder. If you are already providing those environment variables to the application, the .NET SDK should use them to automatically populate the resource service attributes. See: https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/trace/customizing-the-sdk/README.md#resource
Could you try removing the manual service name and namespace configuration?
.ConfigureResource(r => r.AddService(serviceName: builder.Configuration["Otel:ServiceName"], serviceNamespace: builder.Configuration["Otel:Namespace"]))
The cart service example application is a good example of auto resource creation from the environment variables:
If the previous proposed solution does not work either, could you try setting a string value instead of reading from environment variables? (to discard any potential issue in Elasticsearch)
.ConfigureResource(r => r.AddService(serviceName: "MyService"))
(Similar example but with a default value: https://github.com/open-telemetry/opentelemetry-dotnet/blob/d8ce51b1b482e7432da0e7498fdc1052eb2ca807/examples/AspNetCore/Program.cs#L39)
Question
Hello everyone.
We currently use Elastic Observability's Elastic APM Agent for our .NET applications that run on k8s and we are migrating to OpenTelemetry, so we can be vendor agnostic and use auto-instrumentation, not requiring specific code changes for each programming language.
I'm using the demo as a basis for this and created an OpenTelemetry Collector, as shown below:
The logs are actually being exported, as I can see in Log Explorer, but the service.name, service.namespace and deployment.environment are not. In fact, I don't know if this is a problem with traces not appearing, apparently only pod logs are being exported, traces and metrics are not.
Here are the environments variables:
Application Code:
Someone had the same problem and could give me some advices?