[Obsolete("Use Google.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceExtensions.TryAddGoogleTraceContextProvider instead.")]public class GoogleTraceProvider:IExternalTraceProvider
If this is registered as a dependency, then Log Entries will be associated with
the Google trace and span.
To be used when the Tracing component of the Google.Cloud.Diagnostics libraries
is not configured, but Google traces are still being generated, for instance,
because the application is being run in Google Cloud.
If the Tracing component is configured, log entries are automatically associated
to Google traces and spans.
Methods
GetCurrentTraceContext(IServiceProvider)
public TraceContextForLogEntry GetCurrentTraceContext(IServiceProvider serviceProvider)
Returns the TraceContextForLogEntry that can be associated to a log entry or
null if there's currently no trace context.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eGoogleTraceProvider\u003c/code\u003e class, part of the \u003ccode\u003eGoogle.Cloud.Diagnostics.AspNetCore3\u003c/code\u003e namespace, is used to associate log entries with Google traces and spans when the Tracing component is not configured, particularly in Google Cloud environments.\u003c/p\u003e\n"],["\u003cp\u003eVersion 4.4.0 of \u003ccode\u003eGoogleTraceProvider\u003c/code\u003e is currently available and earlier versions include 5.2.0, 5.1.0, 5.0.0, and 4.3.1.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGoogleTraceProvider\u003c/code\u003e implements the \u003ccode\u003eIExternalTraceProvider\u003c/code\u003e interface, and the class is now considered obsolete, with users being encouraged to use \u003ccode\u003eGoogle.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceExtensions.TryAddGoogleTraceContextProvider\u003c/code\u003e instead.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGetCurrentTraceContext\u003c/code\u003e method allows retrieval of the \u003ccode\u003eTraceContextForLogEntry\u003c/code\u003e, which is either the current trace context to be associated with a log entry or null if there is no present trace context.\u003c/p\u003e\n"],["\u003cp\u003eIf registered as a dependency, Log Entries will be associated with the Google trace and span.\u003c/p\u003e\n"]]],[],null,[]]