Skip to content

Conversation

martincostello
Copy link
Member

@martincostello martincostello commented Sep 5, 2025

Changes were agreed in the SIG on Tuesday 2nd September.

Changes

  • Remove the SetDbStatementForText option from SqlClient and behave as if it were enabled.
  • Remove the SetDbStatementFor* options from the EntityFramework instrumentation and behave as if they were enabled.
  • Fix copy-pasta for SetDbQueryParameters in the EFCore and SqlClient READMEs.
  • Use TheoryData<T> for EventSourceFakeTests.

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)

- Remove the `SetDbStatementForText` option and behave as if it were enabled.
- Fix copy-pasta for `SetDbQueryParameters` in the README.
- Use `TheoryData<T>` for `EventSourceFakeTests`.
- Remove the `SetDbStatementFor*` options from the EntityFramework instrumentation.
- Fix-up SqlClient CHANGELOG and README from previous commit.
Remove members from the public API that no nothing on .NET Framework and .NET Standard.
@Copilot Copilot AI review requested due to automatic review settings September 5, 2025 09:41
@martincostello martincostello requested a review from a team as a code owner September 5, 2025 09:41
@github-actions github-actions bot added comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient labels Sep 5, 2025
Copy link
Contributor

@Copilot 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

This PR tidies up the public API surface for SqlClient and EntityFramework instrumentation by removing configuration options that are now always enabled and consolidating behaviors across platforms.

  • Remove SetDbStatementForText and related options from SqlClient and EntityFramework instrumentation
  • Remove non-functional members from SqlClient public API on .NET Framework and .NET Standard
  • Fix documentation and use TheoryData<T> for improved test maintainability

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
SqlEventSourceTests.netfx.cs Convert to TheoryData<T> and remove captureText parameter from test cases
SqlClientTraceInstrumentationOptions.cs Remove SetDbStatementForText property and platform-specific functionality
SqlClientDiagnosticListener.cs Remove conditional logic for SetDbStatementForText and wrap .NET-only features
EntityFrameworkInstrumentationOptions.cs Remove SetDbStatementFor* properties that controlled statement capture
EntityFrameworkDiagnosticListener.cs Remove conditional checks for statement capture options
Various test files Update tests to remove captureText/SetDbStatementForText parameters
README files Remove documentation for removed options and fix parameter name typos
CHANGELOG files Document the removal of these configuration options
PublicAPI files Update API surface to reflect removed properties

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

codecov bot commented Sep 5, 2025

Codecov Report

❌ Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.80%. Comparing base (b324796) to head (93abee1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...mplementation/EntityFrameworkDiagnosticListener.cs 58.33% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3072      +/-   ##
==========================================
- Coverage   69.84%   69.80%   -0.04%     
==========================================
  Files         410      410              
  Lines       16289    16280       -9     
==========================================
- Hits        11377    11365      -12     
- Misses       4912     4915       +3     
Flag Coverage Δ
unittests-Instrumentation.EntityFrameworkCore 81.43% <58.33%> (+0.09%) ⬆️
unittests-Instrumentation.SqlClient 86.68% <100.00%> (-0.07%) ⬇️

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

Files with missing lines Coverage Δ
...eworkCore/EntityFrameworkInstrumentationOptions.cs 100.00% <ø> (ø)
...ient/Implementation/SqlClientDiagnosticListener.cs 88.31% <100.00%> (-0.08%) ⬇️
...ent/Implementation/SqlEventSourceListener.netfx.cs 81.08% <100.00%> (ø)
....SqlClient/SqlClientTraceInstrumentationOptions.cs 100.00% <ø> (ø)
...mplementation/EntityFrameworkDiagnosticListener.cs 85.92% <58.33%> (+0.34%) ⬆️

... and 5 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.

Add PR numbers to CHANGELOGs.
Copy link
Member

@Kielek Kielek left a comment

Choose a reason for hiding this comment

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

I would split removal of Enrich/Filter/etc from this PR and keep here only DBStatement related options
It might be easier to review, especially for the user of library.

Comment on lines 27 to 29
* The `SetDbStatementForStoredProcedure` and `SetDbStatementForText` properties have
been removed. Behaviors related to this option are now always enabled.
([#3072](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3072))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* The `SetDbStatementForStoredProcedure` and `SetDbStatementForText` properties have
been removed. Behaviors related to this option are now always enabled.
([#3072](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3072))
* **Breaking change**: The `SetDbStatementForStoredProcedure` and
`SetDbStatementForText` properties have been removed. Behaviors related
to this option are now always enabled.
([#3072](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3072))

listener.
([#3041](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3041))

* The `SetDbStatementForText` property has been removed. Behaviors related to this
Copy link
Member

Choose a reason for hiding this comment

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

Breaking change note

option are now always enabled.
([#3072](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3072))

* The `Enrich`, `Filter` and `RecordException` properties have been removed from
Copy link
Member

Choose a reason for hiding this comment

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

Breaking change note

@martincostello
Copy link
Member Author

It might be easier to review, especially for the user of library.

They could review the individual commits? I can split it up if needed, but given this PR was already deleting things I figured doing in en-masse was better than having two PRs essentially doing the same thing one after another.

Add breaking change note to removed items.
@Kielek
Copy link
Member

Kielek commented Sep 5, 2025

It might be easier to review, especially for the user of library.

They could review the individual commits? I can split it up if needed, but given this PR was already deleting things I figured doing in en-masse was better than having two PRs essentially doing the same thing one after another.

Sure, it is not blocking, easier, less clicks to do. Especially in context of removing in partially from .NET Framework only

@martincostello martincostello changed the title [EFCore] [SqlClient] Tidy-up public API surface [EFCore] [SqlClient] Remove SetDbStatementFor* options Sep 5, 2025
Comment on lines 9 to 10
OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions.SetDbQueryParameters.get -> bool
OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions.SetDbQueryParameters.set -> void
Copy link
Member

@alanwest alanwest Sep 5, 2025

Choose a reason for hiding this comment

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

Sorry, but I missed the PR this was introduced in. The db.query.parameter.* attribute is not stable and still considered in development. This means it could be renamed or perhaps even removed altogether.

Because of this, I do not think we should expose this configuration publicly in prep for the stable release. I'd be ok gating it behind an experimental environment variable or something.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch. Issue created.

Copy link
Member

@alanwest alanwest left a comment

Choose a reason for hiding this comment

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

👍 thanks @martincostello! Just left a comment unrelated to this PR about SetDbQueryParameters

@Kielek Kielek merged commit abe21ba into open-telemetry:main Sep 8, 2025
72 checks passed
@martincostello martincostello deleted the remove-SetDbStatement branch September 8, 2025 08:17
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 comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sql] Consider removing the SetDbStatementForText configuration option [SqlClient/EFCore] Rename SetDbStatement* options

4 participants