# Namespace Google.Cloud.Diagnostics.AspNetCore (4.4.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [4.4.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/4.3.1/Google.Cloud.Diagnostics.AspNetCore)

## Classes

### [AspNetCoreErrorReportingExtensions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.AspNetCoreErrorReportingExtensions)

Extensions for configuring Google Cloud Error Reporting in ASP.NET Core applications.

### [AspNetCoreGoogleDiagnosticsExtensions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.AspNetCoreGoogleDiagnosticsExtensions)

Extensions to configure Google.Cloud.Diagnostics for ASP.NET Core applications.

### [AspNetCoreTraceExtensions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceExtensions)

Extensions for configuring Google Cloud Trace in ASP.NET Core applications.

### [AspNetCoreTraceOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.AspNetCoreTraceOptions)

Configuration for initializing tracing for ASP.NET Core applications.

### [ClientIpLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ClientIpLogEntryLabelProvider)

A [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementation which adds the client's IP-address to the log entry labels.

### [CloudTraceExtension](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.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.

### [EnvironmentNameLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.EnvironmentNameLogEntryLabelProvider)

A [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementation which adds the [EnvironmentName](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.hosting.ihostingenvironment.environmentname#microsoft-aspnetcore-hosting-ihostingenvironment-environmentname) to the log entry labels.

### [ErrorReportingExceptionLoggerExtension](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ErrorReportingExceptionLoggerExtension)

Uses the Google Cloud Error Reporting Exception Logger Middleware.
To ensure all unhandled exceptions are reported, this should be
the first piece of middleware used.

### [ErrorReportingExceptionLoggerMiddleware](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ErrorReportingExceptionLoggerMiddleware)

Middleware that will, when invoked, call the next [RequestDelegate](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.requestdelegate),
catch any exception that it may throw, send that exception to the
Google Cloud Error Reporting API and rethrow the given exception.

### [ErrorReportingServiceOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ErrorReportingServiceOptions)

Configuration for initializing error reporting.

### [GoogleDiagnosticsWebHostBuilderExtensions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleDiagnosticsWebHostBuilderExtensions)

Extensions to configure Google Diagnostics on the [IWebHostBuilder](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.hosting.iwebhostbuilder).

### [GoogleLogger](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleLogger)

[ILogger](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger) for Google Cloud Logging.

### [GoogleLoggerFactoryExtensions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleLoggerFactoryExtensions)

Extensions to add [GoogleLoggerProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleLoggerProvider)s to an [ILoggerFactory](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.iloggerfactory).

### [GoogleLoggerProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleLoggerProvider)

[ILoggerProvider](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.iloggerprovider) for Google Cloud Logging.

### [GoogleTraceProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleTraceProvider)

If this is registered as a dependency, then Log Entries will be associated with
the Google trace and span.

### [HttpLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.HttpLogEntryLabelProvider)

Base class for [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementations which needs an [HttpContext](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext) instance.

### [LabelProviderExtensions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.LabelProviderExtensions)

Provides extension methods to register [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementations.

### [LoggerOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.LoggerOptions)

Options for a [GoogleLogger](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleLogger).

### [TraceContextForLogEntry](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.TraceContextForLogEntry)

Represents a trace context (Trace ID and Span ID)
for a log entry.
These values can be attached to a log entry to establish the
relation of it and a trace.

### [TraceDecisionPredicate](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.TraceDecisionPredicate)

Used to determine if an [HttpRequest](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httprequest) should be traced. This will not override
a decision by the trace header.

### [TraceIdLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.TraceIdLogEntryLabelProvider)

A [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementation which adds the [TraceIdentifier](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext.traceidentifier#microsoft-aspnetcore-http-httpcontext-traceidentifier) to the log entry labels.

### [TraceServiceOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.TraceServiceOptions)

Configuration for initializing tracing.

### [UserLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.UserLogEntryLabelProvider)

A [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) which adds the information of the authenticated user to the log entry labels.

## Interfaces

### [ICloudTraceNameProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ICloudTraceNameProvider)

Interface for implementing providers that can name trace spans

### [IExceptionLogger](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.IExceptionLogger)

A generic exception logger.

### [IExternalTraceProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.IExternalTraceProvider)

Provides external trace information to include in a log entry
if there's no Google Trace available.
Implement this interface when traces are being generated by your environment
and sent to Google Cloud Tracing not via the Google.Cloud.Diagnostics library.

### [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider)

Provides a hook to augment labels when a log entry is being logged.