-
Notifications
You must be signed in to change notification settings - Fork 5.1k
HttpClientHandler request metrics #87319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
ec16299
initial implementation of request metrics
antonfirsov 2bacea0
simplify error handling code and add comments
antonfirsov 74597a4
typo
antonfirsov 12af084
fix Http.Unit.Tests build failure
antonfirsov 528f3b1
wip
antonfirsov 0d97a7d
Merge branch 'main' into MetricsHandler-02
antonfirsov 4fcfee6
callback-based enrichment API with reftype context
antonfirsov bd461c8
Protect against re-reentrancy
antonfirsov 3c80a0b
use shared counters with the shared meter
antonfirsov 7406c46
do not cache instruments already cached by Meter
antonfirsov 9da9485
use [ThreadStatic] instead of ThreadLocal
antonfirsov 9251264
Merge branch 'main' into MetricsHandler-05
antonfirsov 2a90c07
sync with main
antonfirsov 869bd34
review feedback
antonfirsov 1d43c3e
use FrozenDictionary for caching status codes
antonfirsov d4eadb1
Merge branch 'main' into MetricsHandler-02
antonfirsov 493e7d8
implement final design
antonfirsov d049d4f
fixup merge
antonfirsov 6d4cd18
rename "contextCache" to "pool"
antonfirsov 9f4dd8e
comments
antonfirsov df6189e
Simplify status code cache
antonfirsov bbc38af
Merge branch 'MetricsHandler-02' of https://github.com/antonfirsov/ru…
antonfirsov cd5e4a4
review feedback
antonfirsov 62f87b2
move instrument names to constants in tests
antonfirsov 6283c24
harden HttpMetricsTest_DefaultMeter
antonfirsov 6b77359
remove unnecessary reference to System.Collections.Immutable
antonfirsov f61c85b
lazy-init s_boxedStatusCodes
antonfirsov 9eb314e
oops
antonfirsov 8e35e19
simplify HttpMetricsTest_DefaultMeter.RequestDuration_Success_Recorde…
antonfirsov 1e7453f
move the default meter tests out of process
antonfirsov e686bee
oops
antonfirsov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace System.Net.Http | ||
{ | ||
public static class HttpRequestOptionsExtensions | ||
{ | ||
private static readonly HttpRequestOptionsKey<IReadOnlyCollection<KeyValuePair<string, object?>>> s_CustomMetricsTagsKey = new("CustomMetricsTags"); | ||
|
||
public static void SetCustomMetricsTags(this HttpRequestOptions options, IReadOnlyCollection<KeyValuePair<string, object?>> tags) | ||
{ | ||
options.Set(s_CustomMetricsTagsKey, tags); | ||
} | ||
|
||
internal static bool TryGetCustomMetricsTags(this HttpRequestOptions options, [MaybeNullWhen(false)] out IReadOnlyCollection<KeyValuePair<string, object?>>? tags) => | ||
options.TryGetValue(s_CustomMetricsTagsKey, out tags); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.