[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 version 4.3.1 of the Google Cloud Diagnostics for ASP.NET Core, is designed to be used when the Tracing component is not configured, but Google traces are still being generated.\u003c/p\u003e\n"],["\u003cp\u003eThis class, which implements \u003ccode\u003eIExternalTraceProvider\u003c/code\u003e, allows log entries to be associated with Google traces and spans if registered as a dependency, and its latest version is 4.4.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGoogleTraceProvider\u003c/code\u003e has one main method, \u003ccode\u003eGetCurrentTraceContext\u003c/code\u003e, which returns a \u003ccode\u003eTraceContextForLogEntry\u003c/code\u003e that can be linked to a log entry, or null if no trace context exists, and requires an \u003ccode\u003eIServiceProvider\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGoogleTraceProvider\u003c/code\u003e class is marked as obsolete and the documentation advises to instead use \u003ccode\u003eGoogle.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceExtensions.TryAddGoogleTraceContextProvider\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,[]]