Class GoogleTraceProvider (4.4.0)

[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.

Inheritance

Object > GoogleTraceProvider

Namespace

Google.Cloud.Diagnostics.AspNetCore3

Assembly

Google.Cloud.Diagnostics.AspNetCore3.dll

Remarks

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.

Parameter
NameDescription
serviceProviderIServiceProvider

The service provider to resolve services from. Must not be null.

Returns
TypeDescription
TraceContextForLogEntry

A TraceContextForLogEntry or null if there's no current trace.