[AspNetCore] Avoid adding tags for traces#3993
[AspNetCore] Avoid adding tags for traces#3993martincostello merged 19 commits intoopen-telemetry:mainfrom
Conversation
Avoid adding tags for ASP.NET Core activities where ASP.NET Core has native support to add them itself.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3993 +/- ##
==========================================
+ Coverage 75.92% 75.99% +0.06%
==========================================
Files 466 466
Lines 18631 18635 +4
==========================================
+ Hits 14146 14161 +15
+ Misses 4485 4474 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Add CHANGELOG entry.
Fix markdown lint warnings.
There was a problem hiding this comment.
Pull request overview
Updates ASP.NET Core tracing instrumentation to avoid setting certain HTTP semantic-convention tags when ASP.NET Core can provide them natively (targeting improved performance on newer runtimes).
Changes:
- Add runtime/app-context gating to skip setting selected HTTP tags when ASP.NET Core native OpenTelemetry data is enabled.
- Refactor event handling and small code-style cleanups in instrumentation wiring.
- Document the behavior and the relevant AppContext switch in the AspNetCore instrumentation changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs | Adds .NET 10 gating + AppContext switch check to conditionally avoid manual tag population. |
| src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md | Documents the new behavior and the AppContext switch guidance. |
| src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationTracerProviderBuilderExtensions.cs | Minor formatting/comment wording updates. |
| src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentation.cs | Minor lambda/dispose style cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix CHANGELOG and comment.
Fix incorrect pattern matching on non-nullable `PathString`.
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Remove trailing space.
Still needs a line between entries.
Update `IsOpenTelemetryActivityDataSuppressed()` to be aware of .NET 11.
- Add a test that validates the activity tags are set regardless of the feature toggle's value. - Remove redundant use of `#if NET` from tests as we don't support .NET Framework anymore.
Update comment. Co-authored-by: Piotr Kiełkowicz <pkiekowicz@splunk.com>
Invert the meaning of the flag.
Clarify the comment for .NET 10.
Fix missing words.
See martincostello#2 (review).
Relates to #3808.
Changes
Avoid adding tags for ASP.NET Core activities where ASP.NET Core has native support to add them itself.
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)