fix(dotnet): target net8.0 and set OTEL_SERVICE_NAME so the wrapper sample emits spans - #2561
fix(dotnet): target net8.0 and set OTEL_SERVICE_NAME so the wrapper sample emits spans#2561vasireddy99 wants to merge 1 commit into
Conversation
…ample emits spans The dotnet aws-sdk/wrapper integration test was failing because the trace contained only Lambda's passive Active-tracing segments; the instrumented handler span and downstream S3 span never reached X-Ray. Retarget the sample to net8.0 (dotnet6 runtime is deprecated) and set OTEL_SERVICE_NAME so the wrapper emits the expected spans.
| environment_variables = { | ||
| OTEL_SERVICE_NAME = var.name | ||
| } | ||
|
|
There was a problem hiding this comment.
Why is this necessary?
There was a problem hiding this comment.
The wrapper doesn't set service.name anywhere, so the OpenTelemetry .NET SDK applies its spec fallback and the instrumented span is exported to X-Ray as unknown_service:dotnet. I confirmed this by deploying the sample without the variable and inspecting the trace:
SEGMENT name='unknown_service:dotnet' origin=None
subsegment name='S3' namespace='aws'
There was a problem hiding this comment.
I understand, so it is a nice to have but it is totally unrelated to the bump in sdk/framework to net 8.
For me i don't see the need to set it given this is just a sample of what is needed. The other examples don't have it & there is alternative ways to setting it which are likely more efficient.
As such Let's take it out as it's not necessary.
The dotnet
aws-sdk/wrapperintegration test was failing because the trace contained only Lambda's passive Active-tracing segments; the instrumented handler span and downstream S3 span never reached X-Ray.Changes
aws-sdksample to net8.0 (thedotnet6Lambda runtime is deprecated) in the.csproj,build.sh, and Terraformmain.tf.OTEL_SERVICE_NAMEon the deployed function so the wrapper emits the expected spans.Testing
Files affected are limited to
dotnet/sample-apps/aws-sdk/.