public static IHttpClientBuilder AddOutgoingGoogleTraceHandler(this IHttpClientBuilder clientBuilder)
Adds an 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.
public static IHttpClientBuilder AddOutgoingGoogleTraceHandler(this IHttpClientBuilder clientBuilder, Func<IServiceProvider, IDictionary<string, string>> labelsProvider)
Adds an 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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis page provides documentation for the \u003ccode\u003eHttpClientBuilderExtensions\u003c/code\u003e class within the \u003ccode\u003eGoogle.Cloud.Diagnostics.Common\u003c/code\u003e namespace, which is a part of the Google Cloud Diagnostics library for .NET.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eHttpClientBuilderExtensions\u003c/code\u003e class offers extension methods for \u003ccode\u003eIHttpClientBuilder\u003c/code\u003e, facilitating the integration of trace propagation for outgoing HTTP requests.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAddOutgoingGoogleTraceHandler\u003c/code\u003e methods are used to add an \u003ccode\u003eUnchainedTraceHeaderPropagatingHandler\u003c/code\u003e to an HTTP client, enabling the propagation of trace information for requests made when the server is under trace.\u003c/p\u003e\n"],["\u003cp\u003eThere are two overloads of the \u003ccode\u003eAddOutgoingGoogleTraceHandler\u003c/code\u003e method, one of which accepts a \u003ccode\u003elabelsProvider\u003c/code\u003e function, which allows to provide a way to add custom labels to the outgoing trace information.\u003c/p\u003e\n"],["\u003cp\u003eThis documentation covers multiple versions of the library, with version 5.2.0 being the latest, but it also covers 5.1.0, 5.0.0, 4.4.0, and 4.3.1.\u003c/p\u003e\n"]]],[],null,[]]