[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"]],[["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-04-09 UTC."],[[["The `GoogleTraceProvider` 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."],["This class, which implements `IExternalTraceProvider`, allows log entries to be associated with Google traces and spans if registered as a dependency, and its latest version is 4.4.0."],["`GoogleTraceProvider` has one main method, `GetCurrentTraceContext`, which returns a `TraceContextForLogEntry` that can be linked to a log entry, or null if no trace context exists, and requires an `IServiceProvider`."],["The `GoogleTraceProvider` class is marked as obsolete and the documentation advises to instead use `Google.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceExtensions.TryAddGoogleTraceContextProvider`."]]],[]]