Skip to content

Conversation

martincostello
Copy link
Member

Changes

Remove members from the public API for SqlClient that do nothing on .NET Framework.

Copied and amended from #3072.

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)

@Copilot Copilot AI review requested due to automatic review settings September 8, 2025 08:42
@martincostello martincostello requested a review from a team as a code owner September 8, 2025 08:42
@github-actions github-actions bot added infra Infra work - CI/CD, code coverage, linters comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient labels Sep 8, 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 removes non-functional public API properties from SqlClient instrumentation on .NET Framework to improve API clarity and consistency.

  • Remove Enrich, Filter, and RecordException properties that were non-functional on .NET Framework
  • Add conditional compilation directives to restrict these properties to .NET targets only
  • Update test files to conditionally use the removed properties

Reviewed Changes

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

Show a summary per file
File Description
SqlClientTraceInstrumentationOptions.cs Wrap non-functional properties with #if !NETFRAMEWORK directives
SqlClientDiagnosticListener.cs Add conditional compilation for filter, enrich, and exception recording logic
Test files Update tests to conditionally use removed properties based on target framework
PublicAPI files Remove properties from general API surface and add framework-specific API files
CHANGELOG.md Document breaking changes for removed properties
Common.prod.props Add support for framework-specific public API files

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

Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.99%. Comparing base (9d50b4b) to head (01285e1).
⚠️ 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    #3079      +/-   ##
==========================================
+ Coverage   69.90%   69.99%   +0.09%     
==========================================
  Files         439      429      -10     
  Lines       16889    16805      -84     
==========================================
- Hits        11806    11763      -43     
+ Misses       5083     5042      -41     
Flag Coverage Δ
unittests-Instrumentation.Cassandra ?
unittests-Instrumentation.SqlClient 87.29% <ø> (ø)

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

Files with missing lines Coverage Δ
...ient/Implementation/SqlClientDiagnosticListener.cs 88.31% <ø> (ø)
....SqlClient/SqlClientTraceInstrumentationOptions.cs 100.00% <ø> (ø)

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

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

@rajkumar-rangaraj, @alanwest, what is your opinion here?
Can we ignore this? .NET Standard target has broader API than .NET Framework.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with removing it. @alanwest Your thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I'm unclear on what's being proposed. Are you asking whether we should remove Filter, Enrich, RecordException from the netstandard build as well?

Copy link
Member

Choose a reason for hiding this comment

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

Only from .net framework, but it leads to warnings muted in this file.
Methods removed int his PR are noop in .net fx

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is only needed until the next version ships to NuGet, then it can be deleted as the baseline in NuGet.org will match.

Copy link
Member

Choose a reason for hiding this comment

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

Methods removed int his PR are noop in .net fx

Then yes it sounds like it's safe to keep the APIs in the netstandard build.

@martincostello
Copy link
Member Author

I don't understand why the linter is complaining about the compatibility suppressions file, but also that file is auto-generated.

@Kielek
Copy link
Member

Kielek commented Sep 8, 2025

I don't understand why the linter is complaining about the compatibility suppressions file, but also that file is auto-generated.

Known issue, you can modify it manually and make the linter happy. It should not be overwritten.

@martincostello
Copy link
Member Author

I still don't understand exactly what it's complaining about though. It seems to be complaining there's some sort of non-ASCII space, but if I replace the spaces on the given line numbers by just pressing the spacebar then Git shows no changes.

@Kielek
Copy link
Member

Kielek commented Sep 8, 2025

I still don't understand exactly what it's complaining about though. It seems to be complaining there's some sort of non-ASCII space, but if I replace the spaces on the given line numbers by just pressing the spacebar then Git shows no changes.

retval += sanitycheck('**/*.xml', allow_eol = (LF,), indent = 4)

4 spaces needed instead of 2?

@martincostello
Copy link
Member Author

Oh, it wasn't clear to me from the workflow/job/step name that formatting other than EOL and non-ASCII was in scope.

martincostello added a commit to martincostello/opentelemetry-dotnet-contrib that referenced this pull request Sep 8, 2025
Make TFM-specific public API baselines not use the specific TFM version.

See open-telemetry#3079 (comment).
@martincostello martincostello force-pushed the sqlclient-tfm-specificity branch from 6cb9772 to 723bfa2 Compare September 9, 2025 08:56
@github-actions github-actions bot removed the infra Infra work - CI/CD, code coverage, linters label Sep 9, 2025
@martincostello martincostello force-pushed the sqlclient-tfm-specificity branch 4 times, most recently from 7526d20 to d762140 Compare September 12, 2025 14:25
@martincostello martincostello force-pushed the sqlclient-tfm-specificity branch from d762140 to 8b7e4ae Compare September 19, 2025 13:27
@Kielek
Copy link
Member

Kielek commented Sep 25, 2025

Discussion solved: #3079 (comment)
Merging.

@Kielek Kielek merged commit 8409e20 into open-telemetry:main Sep 25, 2025
68 checks passed
@martincostello martincostello deleted the sqlclient-tfm-specificity branch September 25, 2025 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants