[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-05-30 UTC."],[[["\u003cp\u003eThe latest version of \u003ccode\u003eGoogleTraceProvider\u003c/code\u003e is 5.2.0, and it allows Log Entries to be associated with Google traces and spans when registered as a dependency.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGoogleTraceProvider\u003c/code\u003e is now obsolete, recommending the use of \u003ccode\u003eGoogle.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceExtensions.TryAddGoogleTraceContextProvider\u003c/code\u003e instead.\u003c/p\u003e\n"],["\u003cp\u003eIt implements \u003ccode\u003eIExternalTraceProvider\u003c/code\u003e and inherits from \u003ccode\u003eObject\u003c/code\u003e, with various inherited members including \u003ccode\u003eGetHashCode\u003c/code\u003e, \u003ccode\u003eGetType\u003c/code\u003e, \u003ccode\u003eMemberwiseClone\u003c/code\u003e, and \u003ccode\u003eToString\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis provider is intended for use when the Tracing component of the Google Cloud Diagnostics library is not configured, but Google traces are being generated, like when the application is in Google Cloud.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGetCurrentTraceContext\u003c/code\u003e method allows retrieval of the \u003ccode\u003eTraceContextForLogEntry\u003c/code\u003e associated with a log entry, or returns null if there is no current trace, requiring an \u003ccode\u003eIServiceProvider\u003c/code\u003e parameter.\u003c/p\u003e\n"]]],[],null,[]]