[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\u003eVersion 4.3.1 of \u003ccode\u003eGoogleTraceProvider\u003c/code\u003e is now obsolete and suggests using \u003ccode\u003eGoogle.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceExtensions.TryAddGoogleTraceContextProvider\u003c/code\u003e instead.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGoogleTraceProvider\u003c/code\u003e class, which implements \u003ccode\u003eIExternalTraceProvider\u003c/code\u003e, enables log entries to be associated with Google trace and span data when registered as a dependency.\u003c/p\u003e\n"],["\u003cp\u003eThis class is specifically designed for scenarios where the Tracing component of Google.Cloud.Diagnostics is not configured, but Google traces are still being generated.\u003c/p\u003e\n"],["\u003cp\u003eThe method \u003ccode\u003eGetCurrentTraceContext(IServiceProvider)\u003c/code\u003e retrieves the \u003ccode\u003eTraceContextForLogEntry\u003c/code\u003e for log association, or null if no trace context is present.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version is 5.2.0, and many previous versions are also available.\u003c/p\u003e\n"]]],[],null,[]]