Skip to content

[EntityFrameworkCore] Add schema URL to traces#4078

Open
martincostello wants to merge 3 commits intoopen-telemetry:mainfrom
martincostello:gh-4064-efcore
Open

[EntityFrameworkCore] Add schema URL to traces#4078
martincostello wants to merge 3 commits intoopen-telemetry:mainfrom
martincostello:gh-4064-efcore

Conversation

@martincostello
Copy link
Copy Markdown
Member

Contributes to #4064.

Changes

Add schema URL to the ActivitySource.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions bot added comp:instrumentation.aspnet Things related to OpenTelemetry.Instrumentation.AspNet comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore labels Apr 8, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.96%. Comparing base (0ecb0b2) to head (a800f30).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4078      +/-   ##
==========================================
+ Coverage   72.83%   72.96%   +0.13%     
==========================================
  Files         460      452       -8     
  Lines       17875    17835      -40     
==========================================
- Hits        13019    13014       -5     
+ Misses       4856     4821      -35     
Flag Coverage Δ
unittests-Instrumentation.Cassandra ?
unittests-Instrumentation.EntityFrameworkCore 80.95% <100.00%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...mplementation/EntityFrameworkDiagnosticListener.cs 85.34% <100.00%> (+0.15%) ⬆️
...tyFrameworkCore/TracerProviderBuilderExtensions.cs 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot removed the comp:instrumentation.aspnet Things related to OpenTelemetry.Instrumentation.AspNet label Apr 9, 2026
@martincostello martincostello marked this pull request as ready for review April 9, 2026 09:25
@martincostello martincostello requested a review from a team as a code owner April 9, 2026 09:25
Copilot AI review requested due to automatic review settings April 9, 2026 09:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds OpenTelemetry schema URL metadata to EntityFrameworkCore instrumentation traces by creating the ActivitySource via the shared factory and updating registration/tests accordingly (contributes to #4064 / #4078).

Changes:

  • Create EF Core ActivitySource using ActivitySourceFactory with semantic conventions version 1.36.0 (enables TelemetrySchemaUrl + version).
  • Update TracerProviderBuilderExtensions to register the new ActivitySource name.
  • Add/extend unit test assertions and update the EF Core instrumentation changelog.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/OpenTelemetry.Instrumentation.EntityFrameworkCore.Tests/EntityFrameworkDiagnosticListenerTests.cs Asserts ActivitySource name/version/schema URL on exported activities.
src/OpenTelemetry.Instrumentation.EntityFrameworkCore/TracerProviderBuilderExtensions.cs Registers EF Core instrumentation by ActivitySource name from the new factory-created source.
src/OpenTelemetry.Instrumentation.EntityFrameworkCore/OpenTelemetry.Instrumentation.EntityFrameworkCore.csproj Links in shared ActivitySourceFactory.cs for schema URL support.
src/OpenTelemetry.Instrumentation.EntityFrameworkCore/Implementation/EntityFrameworkDiagnosticListener.cs Switches EF Core activity source creation to ActivitySourceFactory and introduces semantic conventions version constant.
src/OpenTelemetry.Instrumentation.EntityFrameworkCore/CHANGELOG.md Notes addition of schema URL to traces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martincostello martincostello marked this pull request as draft April 12, 2026 12:44
@martincostello
Copy link
Copy Markdown
Member Author

Need to update to account for OTEL_SEMCONV_STABILITY_OPT_IN.

Set the right schema URL based on the version of the semantic conventions being used via `OTEL_SEMCONV_STABILITY_OPT_IN`.
@martincostello martincostello marked this pull request as ready for review April 12, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants