1 instantiation of HttpMetricsEnrichmentContext
System.Net.Http (1)
System\Net\Http\Metrics\HttpMetricsEnrichmentContext.cs (1)
93
context = new
HttpMetricsEnrichmentContext
();
14 references to HttpMetricsEnrichmentContext
System.Net.Http (14)
System\Net\Http\Metrics\HttpMetricsEnrichmentContext.cs (12)
17
/// Enrichment is done on per-request basis by callbacks registered with <see cref="AddCallback(HttpRequestMessage, Action{
HttpMetricsEnrichmentContext
})"/>.
19
/// information exposed on the <see cref="
HttpMetricsEnrichmentContext
"/> instance.
22
/// > The <see cref="
HttpMetricsEnrichmentContext
"/> intance must not be used from outside of the enrichment callbacks.
26
private static readonly HttpRequestOptionsKey<
HttpMetricsEnrichmentContext
> s_optionsKeyForContext = new(nameof(
HttpMetricsEnrichmentContext
));
27
private static readonly ConcurrentQueue<
HttpMetricsEnrichmentContext
> s_pool = new();
31
private readonly List<Action<
HttpMetricsEnrichmentContext
>> _callbacks = new();
78
public static void AddCallback(HttpRequestMessage request, Action<
HttpMetricsEnrichmentContext
> callback)
84
if (!options.TryGetValue(s_optionsKeyForContext, out
HttpMetricsEnrichmentContext
? context))
101
internal static
HttpMetricsEnrichmentContext
? GetEnrichmentContextForRequest(HttpRequestMessage request)
107
request._options.TryGetValue(s_optionsKeyForContext, out
HttpMetricsEnrichmentContext
? context);
135
foreach (Action<
HttpMetricsEnrichmentContext
> callback in _callbacks)
System\Net\Http\Metrics\MetricsHandler.cs (2)
124
HttpMetricsEnrichmentContext
? enrichmentContext =
HttpMetricsEnrichmentContext
.GetEnrichmentContextForRequest(request);