Edit

Share via


HttpMetricsEnrichmentContext Class

Definition

Provides functionality for enriching the http.client.request.duration metric.

public ref class HttpMetricsEnrichmentContext sealed
public sealed class HttpMetricsEnrichmentContext
type HttpMetricsEnrichmentContext = class
Public NotInheritable Class HttpMetricsEnrichmentContext
Inheritance
HttpMetricsEnrichmentContext

Remarks

Enrichment is done on per-request basis by callbacks registered with AddCallback(HttpRequestMessage, Action<HttpMetricsEnrichmentContext>).

The callbacks are responsible for adding custom tags via AddCustomTag(String, Object) for which they can use the request, response, and error information exposed on the HttpMetricsEnrichmentContext instance.

Important

The HttpMetricsEnrichmentContext instance must not be used from outside of the enrichment callbacks.

Properties

Exception

Gets the exception that occurred, or null if there was no error.

Request

Gets the HttpRequestMessage that has been sent.

Response

Gets the HttpRequestMessage received from the server, or null if the request failed.

Methods

AddCallback(HttpRequestMessage, Action<HttpMetricsEnrichmentContext>)

Adds a callback to register custom tags for the http.client.request.duration metric.

AddCustomTag(String, Object)

Appends a custom tag to the list of tags to be recorded with the http.client.request.duration metric.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to