Google.Cloud.Diagnostics.Common - Class HttpClientBuilderExtensions (5.1.0)

public static class HttpClientBuilderExtensions

Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class HttpClientBuilderExtensions.

Extensions methods for IHttpClientBuilder.

Inheritance

object > HttpClientBuilderExtensions

Namespace

GoogleCloudGoogle.Cloud.DiagnosticsCommon

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.

labelsProviderFuncIServiceProviderIDictionarystringstring

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