[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-07 UTC."],[[["`GoogleTraceProvider` is an `IExternalTraceProvider` that associates log entries with Google traces and spans when registered as a dependency, specifically when the tracing component is not configured but traces are generated."],["Version 4.4.0 is the latest release of `GoogleTraceProvider`, with version 4.3.1 being an older release, and the older release has a notice that indicates that it is obsolete."],["The `GetCurrentTraceContext` method retrieves the `TraceContextForLogEntry`, which can be associated with a log entry, or returns null if no trace context exists, and it requires a non-null `IServiceProvider`."],["`GoogleTraceProvider` is designed for scenarios where applications are running in Google Cloud and generating Google traces, but have not explicitly configured the tracing component of the Google Cloud Diagnostics libraries."],["When the tracing component of Google Cloud Diagnostics is configured, the association between log entries and traces occurs automatically without needing to register this."]]],[]]