Skip to content

fix(dotnet): target net8.0 and set OTEL_SERVICE_NAME so the wrapper sample emits spans - #2561

Open
vasireddy99 wants to merge 1 commit into
open-telemetry:mainfrom
vasireddy99:dotnet-net8-sample
Open

fix(dotnet): target net8.0 and set OTEL_SERVICE_NAME so the wrapper sample emits spans#2561
vasireddy99 wants to merge 1 commit into
open-telemetry:mainfrom
vasireddy99:dotnet-net8-sample

Conversation

@vasireddy99

Copy link
Copy Markdown
Contributor

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.

Changes

  • Retarget the aws-sdk sample to net8.0 (the dotnet6 Lambda runtime is deprecated) in the .csproj, build.sh, and Terraform main.tf.
  • Set OTEL_SERVICE_NAME on the deployed function so the wrapper emits the expected spans.

Testing

Files affected are limited to dotnet/sample-apps/aws-sdk/.

…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.
@vasireddy99
vasireddy99 requested a review from a team as a code owner August 28, 2026 14:59
@github-actions github-actions Bot added .NET Pull requests that update .net code terraform labels Aug 28, 2026
Comment on lines +16 to +19
environment_variables = {
OTEL_SERVICE_NAME = var.name
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Pull requests that update .net code terraform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants