1 instantiation of HttpMetricsEnrichmentContext
System.Net.Http (1)
System\Net\Http\Metrics\HttpMetricsEnrichmentContext.cs (1)
108
var context = new
HttpMetricsEnrichmentContext
15 references to HttpMetricsEnrichmentContext
System.Net.Http (15)
System\Net\Http\Metrics\HttpMetricsEnrichmentContext.cs (12)
14
/// Enrichment is done on per-request basis by callbacks registered with <see cref="AddCallback(HttpRequestMessage, Action{
HttpMetricsEnrichmentContext
})"/>.
16
/// information exposed on the <see cref="
HttpMetricsEnrichmentContext
"/> instance.
19
/// > The <see cref="
HttpMetricsEnrichmentContext
"/> instance must not be used from outside of the enrichment callbacks.
23
private static readonly HttpRequestOptionsKey<List<Action<
HttpMetricsEnrichmentContext
>>> s_optionsKeyForCallbacks = new(nameof(
HttpMetricsEnrichmentContext
));
71
public static void AddCallback(HttpRequestMessage request, Action<
HttpMetricsEnrichmentContext
> callback)
78
if (options.TryGetValue(s_optionsKeyForCallbacks, out List<Action<
HttpMetricsEnrichmentContext
>>? callbacks))
88
internal static List<Action<
HttpMetricsEnrichmentContext
>>? GetEnrichmentCallbacksForRequest(HttpRequestMessage request)
93
return (List<Action<
HttpMetricsEnrichmentContext
>>)callbacks!;
100
List<Action<
HttpMetricsEnrichmentContext
>> callbacks,
108
var
context = new HttpMetricsEnrichmentContext
116
foreach (Action<
HttpMetricsEnrichmentContext
> callback in callbacks)
System\Net\Http\Metrics\MetricsHandler.cs (3)
129
List<Action<
HttpMetricsEnrichmentContext
>>? callbacks =
HttpMetricsEnrichmentContext
.GetEnrichmentCallbacksForRequest(request);
136
HttpMetricsEnrichmentContext
.RecordDurationWithEnrichment(callbacks, request, response, exception, durationTime, tags, _requestsDuration);