Class HttpClientBuilderExtensions (5.0.0)

public static class HttpClientBuilderExtensions

Extensions methods for IHttpClientBuilder.

Inheritance

Object > HttpClientBuilderExtensions

Namespace

Google.Cloud.Diagnostics.Common

Assembly

Google.Cloud.Diagnostics.Common.dll

Methods

AddOutgoingGoogleTraceHandler(IHttpClientBuilder)

public static IHttpClientBuilder AddOutgoingGoogleTraceHandler(this IHttpClientBuilder clientBuilder)

Adds an Google.Cloud.Diagnostics.Common.UnchainedTraceHeaderPropagatingHandler to the HTTP client being built, which will propagate trace information for outgoing requests, made with this client, when the request being handled by this server is already being traced.

Parameter
NameDescription
clientBuilderIHttpClientBuilder

The IHttpClientBuilder to add this handler to.

Returns
TypeDescription
IHttpClientBuilder

AddOutgoingGoogleTraceHandler(IHttpClientBuilder, Func<IServiceProvider, IDictionary<String, String>>)

public static IHttpClientBuilder AddOutgoingGoogleTraceHandler(this IHttpClientBuilder clientBuilder, Func<IServiceProvider, IDictionary<string, string>> labelsProvider)

Adds an Google.Cloud.Diagnostics.Common.UnchainedTraceHeaderPropagatingHandler to the HTTP client being built, which will propagate trace information for outgoing requests, made with this client, when the request being handled by this server is already being traced.

Parameters
NameDescription
clientBuilderIHttpClientBuilder

The IHttpClientBuilder to add this handler to.

labelsProviderFunc<IServiceProvider, IDictionary<String, String>>

A function that provides labels that will be added to the outgoing trace. The function will be called once per handler, on creation, and the labels obtained at that point will be used for all subsequent requests made through this handler. Note that the scope of the IServiceProvider argument will share the lifetime of the handler being created. May be null, in which case no costum labels will be added to the outgoing trace.

Returns
TypeDescription
IHttpClientBuilder