Skip to content

Conversation

@pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Apr 7, 2025

  • use System.Diagnostics.Metrics.Meter.IsSupported to disable/trim MetricsHandler
  • use System.Net.Http.EnableActivityPropagation to disable/trim DiagnosticsHandler

- use System.Diagnostics.Metrics.Meter.IsSupported
- call EventSource.EnableActivityTracker() when DiagnosticsHandler is enabled
@pavelsavara pavelsavara added this to the 10.0.0 milestone Apr 7, 2025
@pavelsavara pavelsavara self-assigned this Apr 7, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@ManickaP
Copy link
Member

ManickaP commented Apr 7, 2025

cc @antonfirsov

Copy link
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.

Copilot reviewed 11 out of 15 changed files in this pull request and generated 2 comments.

Files not reviewed (4)
  • src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.xml: Language not supported
  • src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj: Language not supported
  • src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.EventSource.xml: Language not supported
  • src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj: Language not supported

Copy link
Member

@javiercn javiercn left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

Does the PR ensure that the SocketsHttpHandlerMetrics and the ConnectionMetrics types are also trimmed away when metrics are disabled?

@pavelsavara
Copy link
Member Author

pavelsavara commented Apr 11, 2025

I added tests. Trimming doesn't work. The constant is not being propagated. I don't know why.

Fixed. It works when there are no indirections between the trimmed property and methods that use them

# Conflicts:
#	src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs
@pavelsavara pavelsavara requested a review from antonfirsov April 11, 2025 09:32
Copy link
Contributor

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

LGTM modulo small suggestion. Thanks!

Edit: Just noticed MetricsHandlerTrimmedTest.cs is failing, will check this again after the fix.

pavelsavara and others added 2 commits April 15, 2025 08:18
…andler/ConnectionPool/HttpConnectionWaiter.cs

Co-authored-by: Anton Firszov <[email protected]>
@pavelsavara pavelsavara merged commit d0e6ce8 into dotnet:main Apr 15, 2025
141 of 151 checks passed
@pavelsavara pavelsavara deleted the browser_MetricsHandler_optional branch April 15, 2025 12:07
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants