[AspNetCore] Add schema URL to traces#4066
[AspNetCore] Add schema URL to traces#4066martincostello merged 8 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4066 +/- ##
==========================================
- Coverage 75.93% 75.92% -0.01%
==========================================
Files 466 466
Lines 18635 18633 -2
==========================================
- Hits 14150 14148 -2
Misses 4485 4485
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Add schema URL to the `ActivitySource`. Contributes to open-telemetry#4064.
Remove redundant test code for .NET Framework.
- Make CHANGELOG more specific. - Remove unused using statement.
Use `ActivitySourceFactory` to create the `Activity`.
35a9b51 to
5614b3b
Compare
Revert `sealed`.
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
| internal static readonly Version Version = AssemblyName.Version!; | ||
| #pragma warning restore IDE0370 // Suppression is unnecessary | ||
| internal static readonly ActivitySource ActivitySource = new(ActivitySourceName, Version.ToString()); | ||
| internal static readonly Version SemanticConventionsVersion = new(1, 40, 0); |
There was a problem hiding this comment.
In general, changes LGTM. Did you have chance to validate if the it really matches 1.40.0 requirements?
Contributes to #4064.
Changes
ActivitySourceuse fornetstandard2.0.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)