Class CloudTraceExtension (4.4.0)

[Obsolete("Use Google.Cloud.Diagnostics.AspNetCore.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

System.Object > CloudTraceExtension

Namespace

Google.Cloud.Diagnostics.AspNetCore

Assembly

Google.Cloud.Diagnostics.AspNetCore.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.AspNetCore.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
Name Description
services Microsoft.Extensions.DependencyInjection.IServiceCollection

The service collection. Must not be null.

setupAction System.Action<TraceServiceOptions>

Action to set up options. Must not be null.

Returns
Type Description
Microsoft.Extensions.DependencyInjection.IServiceCollection
Remarks

If ExceptionHandling is set to Propagate and the Microsoft.AspNetCore.Http.RequestDelegate executed by this middleware throws ad exception and this diagnostics library also throws an exception trying to report it and System.AggregateException with both exceptions will be thrown. Otherwise only the exception from the Microsoft.AspNetCore.Http.RequestDelegate will be thrown.

UseGoogleTrace(IApplicationBuilder)

[Obsolete("Use Google.Cloud.Diagnostics.AspNetCore.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
Name Description
app Microsoft.AspNetCore.Builder.IApplicationBuilder
Returns
Type Description
Microsoft.AspNetCore.Builder.IApplicationBuilder