Class CloudTraceExtension

[Obsolete("Use Google.Cloud.Diagnostics.AspNetCore3.AspNetCoreTraceExtensions instead.")]
public static class CloudTraceExtension

Uses the Google Cloud Trace Middleware. Traces the time taken for all subsequent delegates to run. The time taken and metadata will be sent to the Google Cloud Trace API. Also allows for more finely grained manual tracing.

Inheritance

Object > CloudTraceExtension

Namespace

Google.Cloud.Diagnostics.AspNetCore3

Assembly

Google.Cloud.Diagnostics.AspNetCore3.dll

Remarks

Traces requests and reports them to Google Cloud Trace. Docs: https://cloud.google.com/trace/docs/

Methods

AddGoogleTrace(IServiceCollection, Action<TraceServiceOptions>)

[Obsolete("Use Google.Cloud.Diagnostics.AspNetCore3.AspNetCoreTraceExtensions.AddGoogleTraceForAspNetCore instead.")]
public static IServiceCollection AddGoogleTrace(this IServiceCollection services, Action<TraceServiceOptions> setupAction)

Adds the needed services for Google Cloud Tracing. Used with UseGoogleTrace(IApplicationBuilder).

Parameters
NameDescription
servicesIServiceCollection

The service collection. Must not be null.

setupActionAction<TraceServiceOptions>

Action to set up options. Must not be null.

Returns
TypeDescription
IServiceCollection
Remarks

If Google.Cloud.Diagnostics.Common.RetryOptions.ExceptionHandling is set to Google.Cloud.Diagnostics.Common.ExceptionHandling.Propagate and the RequestDelegate executed by this middleware throws ad exception and this diagnostics library also throws an exception trying to report it and AggregateException with both exceptions will be thrown. Otherwise only the exception from the RequestDelegate will be thrown.

UseGoogleTrace(IApplicationBuilder)

[Obsolete("Use Google.Cloud.Diagnostics.AspNetCore3.AspNetCoreTraceExtensions.AddGoogleTraceForAspNetCorefor configuring Google Cloud Trace in ASP.NET Core applications. There's no need to explicitly register the middleware.")]
public static IApplicationBuilder UseGoogleTrace(this IApplicationBuilder app)

Uses middleware that will trace time taken for all subsequent delegates to run. The time taken and metadata will be sent to the Google Cloud Trace API. To be used with AddGoogleTrace(IServiceCollection, Action<TraceServiceOptions>),

Parameter
NameDescription
appIApplicationBuilder
Returns
TypeDescription
IApplicationBuilder