[AspNetCore] Add schema URL to traces#4066
Open
martincostello wants to merge 4 commits intoopen-telemetry:mainfrom
Open
[AspNetCore] Add schema URL to traces#4066martincostello wants to merge 4 commits intoopen-telemetry:mainfrom
martincostello wants to merge 4 commits intoopen-telemetry:mainfrom
Conversation
Add schema URL to the `ActivitySource`. Contributes to open-telemetry#4064.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4066 +/- ##
==========================================
+ Coverage 72.75% 72.90% +0.15%
==========================================
Files 458 448 -10
Lines 17876 17832 -44
==========================================
- Hits 13006 13001 -5
+ Misses 4870 4831 -39
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Add PR number.
Remove redundant test code for .NET Framework.
15 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the ASP.NET Core instrumentation to attach an OpenTelemetry schema URL to the ActivitySource used in the legacy (non-.NET 7+) tracing path, and cleans up conditional compilation in related unit tests.
Changes:
- Create
HttpInListener.ActivitySourceviaActivitySourceOptionsto setTelemetrySchemaUrl(and use package version viaGetPackageVersion()). - Update tracer provider source registration to reference
HttpInListener.ActivitySource.Namein the legacy path. - Remove redundant
#if NETguards in test code.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/TestApplicationFactory.cs | Removes #if NET around Minimal API MapGroup route setup. |
| test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs | Removes #if NET guards; leaves an unused using that should be cleaned up. |
| test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs | Simplifies assertions by removing #if NET branches for ActivitySource name/version validation. |
| src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj | Adds AssemblyVersionExtensions.cs include to support GetPackageVersion(). |
| src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs | Introduces CreateActivitySource() using ActivitySourceOptions with schema URL + package version. |
| src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md | Adds changelog entry for schema URL change (currently worded more broadly than the implementation scope). |
| src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationTracerProviderBuilderExtensions.cs | Uses HttpInListener.ActivitySource.Name when registering sources for the legacy path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
Show resolved
Hide resolved
test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs
Outdated
Show resolved
Hide resolved
- Make CHANGELOG more specific. - Remove unused using statement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #4064.
Changes
ActivitySourceuse fornetstandard2.0.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)