From 8fdc5ad7052790a06d3fa775cfc966d83c8455ca Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Wed, 18 Jun 2025 10:14:48 -0700 Subject: [PATCH 1/4] Update filters.md (#35627) * Update filters.md Remove a problematic image. * Update aspnetcore/mvc/controllers/filters.md Co-authored-by: Wade Pickett * Update aspnetcore/mvc/controllers/filters.md Co-authored-by: Wade Pickett --------- Co-authored-by: Wade Pickett --- aspnetcore/mvc/controllers/filters.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aspnetcore/mvc/controllers/filters.md b/aspnetcore/mvc/controllers/filters.md index 43ac08d5239d..8735f1c395b3 100644 --- a/aspnetcore/mvc/controllers/filters.md +++ b/aspnetcore/mvc/controllers/filters.md @@ -65,7 +65,11 @@ Each filter type is executed at a different stage in the filter pipeline: * Are **not** supported in Razor Pages. * Can be invoked on both actions and route handler-based endpoints. -* [Exception filters](#exception-filters) apply global policies to unhandled exceptions that occur before the response body has been written to. +* [Exception filters](#exception-filters): + * Apply global policies to unhandled exceptions that occur before the response body has been written to. + * Run after model binding and action filters, but before the action result is executed. + * Run only if an unhandled exception occurs during action execution or action result execution. + * Do not run for exceptions thrown during middleware execution, routing, or model binding. * [Result filters](#result-filters): @@ -73,10 +77,6 @@ Each filter type is executed at a different stage in the filter pipeline: * Run only when the action method executes successfully. * Are useful for logic that must surround view or formatter execution. -The following diagram shows how filter types interact in the filter pipeline: - -:::image source="~/mvc/controllers/filters/_static/filter-pipeline-2.png" alt-text="The request is processed through Authorization Filters, Resource Filters, Model Binding, Action Filters, Action Execution and Action Result Conversion, Exception Filters, Result Filters, and Result Execution. On the way out, the request is only processed by Result Filters and Resource Filters before becoming a response sent to the client."::: - Razor Pages also support [Razor Page filters](xref:razor-pages/filter), which run before and after a Razor Page handler. ## Implementation @@ -543,4 +543,4 @@ When passing an *instance* of a filter into `Add`, instead of its `Type`, the fi * :::moniker-end -[!INCLUDE[](~/mvc/controllers/filters/includes/filters7.md)] \ No newline at end of file +[!INCLUDE[](~/mvc/controllers/filters/includes/filters7.md)] From aed1619aea5c5dd2d8c7e984c9fd07c6562ab4b5 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Thu, 19 Jun 2025 13:03:01 -0400 Subject: [PATCH 2/4] Remove depreciated tooling crosslink (#35644) --- aspnetcore/blazor/globalization-localization.md | 1 - aspnetcore/fundamentals/localization.md | 1 - aspnetcore/fundamentals/localization/includes/localization35.md | 2 -- .../localization/includes/make-content-localizable5.md | 1 - .../fundamentals/localization/includes/provide-resources5.md | 1 - .../localization/includes/select-language-culture5.md | 1 - .../localization/includes/select-language-culture67.md | 1 - .../fundamentals/localization/make-content-localizable.md | 1 - aspnetcore/fundamentals/localization/provide-resources.md | 1 - aspnetcore/fundamentals/localization/select-language-culture.md | 1 - 10 files changed, 11 deletions(-) diff --git a/aspnetcore/blazor/globalization-localization.md b/aspnetcore/blazor/globalization-localization.md index 00530e12f56d..882af2d91262 100644 --- a/aspnetcore/blazor/globalization-localization.md +++ b/aspnetcore/blazor/globalization-localization.md @@ -1750,7 +1750,6 @@ For more information, see [Blazor Localization does not work with InteractiveSer * * [Globalizing and localizing .NET applications](/dotnet/core/extensions/globalization-and-localization) * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) * [Calling `InvokeAsync(StateHasChanged)` causes page to fallback to default culture (dotnet/aspnetcore #28521)](https://github.com/dotnet/aspnetcore/issues/28521) * [Blazor Localization does not work with InteractiveServer (`dotnet/aspnetcore` #53707)](https://github.com/dotnet/aspnetcore/issues/53707) ([Location override using "Sensors" pane](#location-override-using-sensors-pane-in-developer-tools)) diff --git a/aspnetcore/fundamentals/localization.md b/aspnetcore/fundamentals/localization.md index 13be4700eeed..eb82772cf3ea 100644 --- a/aspnetcore/fundamentals/localization.md +++ b/aspnetcore/fundamentals/localization.md @@ -58,7 +58,6 @@ Move mini TOC from ## Additional resources to here * * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/includes/localization35.md b/aspnetcore/fundamentals/localization/includes/localization35.md index ed742b15ba4e..981f1080ee26 100644 --- a/aspnetcore/fundamentals/localization/includes/localization35.md +++ b/aspnetcore/fundamentals/localization/includes/localization35.md @@ -38,7 +38,6 @@ Globalizing and localizing an app involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end @@ -409,7 +408,6 @@ Terms: * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/includes/make-content-localizable5.md b/aspnetcore/fundamentals/localization/includes/make-content-localizable5.md index fa7f5cd97388..8664aac13c9d 100644 --- a/aspnetcore/fundamentals/localization/includes/make-content-localizable5.md +++ b/aspnetcore/fundamentals/localization/includes/make-content-localizable5.md @@ -132,7 +132,6 @@ Localizing an app also involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/includes/provide-resources5.md b/aspnetcore/fundamentals/localization/includes/provide-resources5.md index 3eec0c86859a..3dbaca2cb499 100644 --- a/aspnetcore/fundamentals/localization/includes/provide-resources5.md +++ b/aspnetcore/fundamentals/localization/includes/provide-resources5.md @@ -107,7 +107,6 @@ Localizing an app also involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/includes/select-language-culture5.md b/aspnetcore/fundamentals/localization/includes/select-language-culture5.md index afc059c1cafa..f021d8b08b5a 100644 --- a/aspnetcore/fundamentals/localization/includes/select-language-culture5.md +++ b/aspnetcore/fundamentals/localization/includes/select-language-culture5.md @@ -165,7 +165,6 @@ Localizing an app also involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/includes/select-language-culture67.md b/aspnetcore/fundamentals/localization/includes/select-language-culture67.md index f4a616c9a3e6..07cb610f7e1a 100644 --- a/aspnetcore/fundamentals/localization/includes/select-language-culture67.md +++ b/aspnetcore/fundamentals/localization/includes/select-language-culture67.md @@ -166,7 +166,6 @@ Localizing an app also involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/make-content-localizable.md b/aspnetcore/fundamentals/localization/make-content-localizable.md index 90a0ce8669d7..6512ab7692a3 100644 --- a/aspnetcore/fundamentals/localization/make-content-localizable.md +++ b/aspnetcore/fundamentals/localization/make-content-localizable.md @@ -142,7 +142,6 @@ Localizing an app also involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/provide-resources.md b/aspnetcore/fundamentals/localization/provide-resources.md index 0c7e5188adb3..9bef44351756 100644 --- a/aspnetcore/fundamentals/localization/provide-resources.md +++ b/aspnetcore/fundamentals/localization/provide-resources.md @@ -124,7 +124,6 @@ Localizing an app also involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end diff --git a/aspnetcore/fundamentals/localization/select-language-culture.md b/aspnetcore/fundamentals/localization/select-language-culture.md index c7984efe7471..35aac6d942ef 100644 --- a/aspnetcore/fundamentals/localization/select-language-culture.md +++ b/aspnetcore/fundamentals/localization/select-language-culture.md @@ -200,7 +200,6 @@ Localizing an app also involves the following tasks: * [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) * [Localization.StarterWeb project](https://github.com/aspnet/Entropy/tree/master/samples/Localization.StarterWeb) used in the article. * [Resources in .resx Files](/dotnet/framework/resources/working-with-resx-files-programmatically) -* [Microsoft Multilingual App Toolkit](https://marketplace.visualstudio.com/items?itemName=MultilingualAppToolkit.MultilingualAppToolkit-18308) * [Localization & Generics](http://hishambinateya.com/localization-and-generics) :::moniker-end From fd1548a6ad98e1f68f121b9d075a9f589bf5350f Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Thu, 19 Jun 2025 17:47:22 -0700 Subject: [PATCH 3/4] Update toc.yml (#35645) --- aspnetcore/toc.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aspnetcore/toc.yml b/aspnetcore/toc.yml index d97cf7d16b4d..cc24e5c4eec5 100644 --- a/aspnetcore/toc.yml +++ b/aspnetcore/toc.yml @@ -1139,9 +1139,6 @@ items: href: https://github.com/grpc/grpc-dotnet/tree/master/examples - name: Troubleshoot uid: grpc/troubleshoot - - name: Best practices - displayName: performance - uid: fundamentals/best-practices - name: Servers items: - name: Overview @@ -1932,6 +1929,9 @@ items: items: - name: Overview uid: performance/overview + - name: Best practices + displayName: performance + uid: fundamentals/best-practices - name: Caching items: - name: Overview From 7833ce9475a0a00b97c575ca6c133b9162aa16a8 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Fri, 20 Jun 2025 08:22:14 -0400 Subject: [PATCH 4/4] Metrics pass (#35646) --- aspnetcore/log-mon/metrics/built-in.md | 551 ++++++++++++++++- .../metrics/built-in/includes/built-in10.md | 583 ------------------ .../metrics/built-in/includes/built-in8.md | 373 ----------- 3 files changed, 544 insertions(+), 963 deletions(-) delete mode 100644 aspnetcore/log-mon/metrics/built-in/includes/built-in10.md delete mode 100644 aspnetcore/log-mon/metrics/built-in/includes/built-in8.md diff --git a/aspnetcore/log-mon/metrics/built-in.md b/aspnetcore/log-mon/metrics/built-in.md index 506ea8df0c43..83d6662f1f46 100644 --- a/aspnetcore/log-mon/metrics/built-in.md +++ b/aspnetcore/log-mon/metrics/built-in.md @@ -1,15 +1,552 @@ --- title: ASP.NET Core built-in metrics -description: Built-in metrics for ASP.NET Core apps -author: rick-anderson -ms.author: riande -ms.date: 4/8/2025 +description: Learn about built-in metrics for ASP.NET Core apps. +author: guardrex +ms.author: wpickett +ms.date: 6/20/2025 ms.topic: reference uid: log-mon/metrics/built-in --- - # ASP.NET Core built-in metrics -[!INCLUDE[](~/log-mon/metrics/built-in/includes/built-in10.md)] +This article describes the built-in metrics for ASP.NET Core produced using the + API. For a listing of metrics based on the older [EventCounters](/dotnet/core/diagnostics/event-counters) API, see [Available counters](/dotnet/core/diagnostics/available-counters). + +For information on how to collect, report, enrich, and test with ASP.NET Core metrics, see . + +:::moniker range=">= aspnetcore-10.0" + +## `Microsoft.AspNetCore.Components` + +The `Microsoft.AspNetCore.Components` metrics report information on Razor component route changes and browser events: + +* [`aspnetcore.components.navigation`](#metric-aspnetcorecomponentsnavigation) +* [`aspnetcore.components.event_handler`](#metric-aspnetcorecomponentsevent_handler) + +### Metric: `aspnetcore.components.navigation` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.components.navigation` | Counter | `{route}` | Tracks the total number of route changes in the app. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.components.type` | string | Component navigated to. | `TestComponent` | Always +`aspnetcore.components.route` | string | The component's route. | `/test-route` | Always + +### Metric: `aspnetcore.components.event_handler` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.components.event_handler` | Histogram | `s` | Measures the duration of processing browser events, including business logic. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.components.type` | string | Component type handling the event. | `TestComponent` | Always +`aspnetcore.components.method` | string | C# method handling the event. | `OnClick` | Always +`aspnetcore.components.attribute.name` | string | Component attribute name handling the event. | `onclick` | Always +`error.type` | string | The full name of exception type. | `System.InvalidOperationException`; `Contoso.MyException` | If an exception is thrown. + +## `Microsoft.AspNetCore.Components.Lifecycle` + +The `Microsoft.AspNetCore.Components.Lifecycle` metrics report information on Razor component lifecycle events: + +* [`aspnetcore.components.update_parameters`](#metric-aspnetcorecomponentsupdate_parameters) +* [`aspnetcore.components.render_diff`](#metric-aspnetcorecomponentsrender_diff) + +### Metric: `aspnetcore.components.update_parameters` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.components.update_parameters` | Histogram | `s` | Measures the duration of processing component parameters, including business logic. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.components.type` | string | Component type handling the event. | `TestComponent` | Always +`error.type` | string | The full name of exception type. | `System.InvalidOperationException`; `Contoso.MyException` | If an exception is thrown. + +### Metric: `aspnetcore.components.render_diff` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.components.render_diff` | Histogram | `s` | Tracks the duration of rendering batches. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.components.diff.length` | int | The length of the render diff. | 50 | Always +`error.type` | string | The full name of exception type. | `System.InvalidOperationException`; `Contoso.MyException` | If an exception is thrown. + +## `Microsoft.AspNetCore.Components.Server.Circuits` + +The `Microsoft.AspNetCore.Components.Server.Circuits` metrics report information on server-side Blazor circuits in Blazor Server and Blazor Web Apps: + +* [`aspnetcore.components.circuit.active`](#metric-aspnetcorecomponentscircuitactive) +* [`aspnetcore.components.circuit.connected`](#metric-aspnetcorecomponentscircuitconnected) +* [`aspnetcore.components.circuit.duration`](#metric-aspnetcorecomponentscircuitduration) + +### Metric: `aspnetcore.components.circuit.active` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.components.circuit.active` | UpDownCounter | `{circuit}` | Shows the number of active circuits currently in memory. + +### Metric: `aspnetcore.components.circuit.connected` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.components.circuit.connected` | UpDownCounter | `{circuit}` | Tracks the number of circuits connected to clients. + +### Metric: `aspnetcore.components.circuit.duration` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.components.circuit.duration` | Histogram | `s` | Measures circuit lifetime duration and provides total circuit count. + +## `Microsoft.AspNetCore.Hosting` + +The `Microsoft.AspNetCore.Hosting` metrics report high-level information about HTTP requests received by ASP.NET Core: + +* [`http.server.request.duration`](#metric-httpserverrequestduration) +* [`http.server.active_requests`](#metric-httpserveractive_requests) + +:::moniker-end + +### Metric: `http.server.request.duration` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`http.server.request.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-http-metrics/#metric-httpclientrequestduration) | Histogram | `s` | Measures the duration of inbound HTTP requests. + +Attribute | Type | Description | Examples | Presence +--- |--- | --- | --- | --- +`http.route` | string | The matched route. | `{controller}/{action}/`
`{id?}`| If it's available. +`error.type` | string | Describes a class of error the operation ended with. | `timeout`; `name_resolution_error`; `500` | If request has ended with an error. +`http.request.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | Always +`http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If one was sent. +`network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `3.1.1` | Always +`url.scheme` | string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Always +`aspnetcore.request.is_unhandled` | Boolean | True when the request wasn't handled by the application pipeline. | `true` | If the request was unhandled. + +The time used to handle an inbound HTTP request as measured at the hosting layer of ASP.NET Core. The time measurement starts once the underlying web host has: + +* Sufficiently parsed the HTTP request headers on the inbound network stream to identify the new request. +* Initialized the context data structures such as the . + +The time ends when: + +* The ASP.NET Core handler pipeline is finished executing. +* All response data has been sent. +* The context data structures for the request are being disposed. + +When using OpenTelemetry, the default buckets for this metric are set to [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]. + +### Metric: `http.server.active_requests` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`http.server.active_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-http-metrics/#metric-httpclientactive_requests) | UpDownCounter | `{request}` | Measures the number of concurrent HTTP requests that are currently in-flight. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`http.request.method` | string | HTTP request method. [1] | `GET`; `POST`; `HEAD` | Always +`url.scheme`| string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Always + +## `Microsoft.AspNetCore.Routing` + +The `Microsoft.AspNetCore.Routing` metrics report information about [routing HTTP requests](/aspnet/core/fundamentals/routing) to ASP.NET Core endpoints: + +* [`aspnetcore.routing.match_attempts`](#metric-aspnetcoreroutingmatch_attempts) + +### Metric: `aspnetcore.routing.match_attempts` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`aspnetcore.routing.match_attempts`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcoreroutingmatch_attempts) | Counter | `{match_attempt}` | Number of requests that were attempted to be matched to an endpoint. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.routing.match_status` | string | Match result | `success`; `failure` | Always +`aspnetcore.routing.is_fallback_route` | boolean | A value that indicates whether the matched route is a fallback route. | `True` | If a route was successfully matched. +`http.route` | string | The matched route | `{controller}/{action}/`
`{id?}` | If a route was successfully matched. + +## `Microsoft.AspNetCore.Diagnostics` + +The `Microsoft.AspNetCore.Diagnostics` metrics report diagnostics information from [ASP.NET Core error handling middleware](/aspnet/core/fundamentals/error-handling): + +* [`aspnetcore.diagnostics.exceptions`](#metric-aspnetcorediagnosticsexceptions) + +### Metric: `aspnetcore.diagnostics.exceptions` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`aspnetcore.diagnostics.exceptions`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorediagnosticsexceptions) | Counter | `{exception}` | Number of exceptions caught by exception handling middleware. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.diagnostics.exception.result` | string | ASP.NET Core exception middleware handling result | `handled`; `unhandled` | Always +`aspnetcore.diagnostics.handler.type` | string | Full type name of the [`IExceptionHandler`](/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception. | `Contoso.MyHandler` | If the exception was handled by this handler. +`exception.type` | string | The full name of exception type. | `System.OperationCanceledException`; `Contoso.MyException` | Always + +## `Microsoft.AspNetCore.RateLimiting` + +The `Microsoft.AspNetCore.RateLimiting` metrics report rate limiting information from [ASP.NET Core rate-limiting middleware](/aspnet/core/performance/rate-limit): + +* [`aspnetcore.rate_limiting.active_request_leases`](#metric-aspnetcorerate_limitingactive_request_leases) +* [`aspnetcore.rate_limiting.request_lease.duration`](#metric-aspnetcorerate_limitingrequest_leaseduration) +* [`aspnetcore.rate_limiting.queued_requests`](#metric-aspnetcorerate_limitingqueued_requests) +* [`aspnetcore.rate_limiting.request.time_in_queue`](#metric-aspnetcorerate_limitingrequesttime_in_queue) +* [`aspnetcore.rate_limiting.requests`](#metric-aspnetcorerate_limitingrequests) + +### Metric: `aspnetcore.rate_limiting.active_request_leases` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +| [`aspnetcore.rate_limiting.active_request_leases`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingactive_request_leases) | UpDownCounter | `{request}` | Number of requests that are currently active on the server that hold a rate limiting lease. | + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. + +### Metric: `aspnetcore.rate_limiting.request_lease.duration` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`aspnetcore.rate_limiting.request_lease.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequest_leaseduration) | Histogram | `s` | The duration of the rate limiting lease held by requests on the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. + +### Metric: `aspnetcore.rate_limiting.queued_requests` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`aspnetcore.rate_limiting.queued_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingqueued_requests) | UpDownCounter | `{request}` | Number of requests that are currently queued waiting to acquire a rate limiting lease. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. + +### Metric: `aspnetcore.rate_limiting.request.time_in_queue` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`aspnetcore.rate_limiting.request.time_in_queue`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequesttime_in_queue) | Histogram | `s` | The time a request spent in a queue waiting to acquire a rate limiting lease. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. +`aspnetcore.rate_limiting.result` | string | The rate limiting result shows whether lease was acquired or contains a rejection reason. | `acquired`; `request_canceled` | Always + +### Metric: `aspnetcore.rate_limiting.requests` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`aspnetcore.rate_limiting.requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequests) | Counter | `{request}` | Number of requests that tried to acquire a rate limiting lease. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. +`aspnetcore.rate_limiting.result` | string | The rate limiting result shows whether lease was acquired or contains a rejection reason. | `acquired`; `request_canceled` | Always + +## `Microsoft.AspNetCore.HeaderParsing` + +The `Microsoft.AspNetCore.HeaderParsing` metrics report information about [ASP.NET Core header parsing](https://www.nuget.org/packages/Microsoft.AspNetCore.HeaderParsing): + +* [`aspnetcore.header_parsing.parse_errors`](#metric-aspnetcoreheader_parsingparse_errors) +* [`aspnetcore.header_parsing.cache_accesses`](#metric-aspnetcoreheader_parsingcache_accesses) + +### Metric: `aspnetcore.header_parsing.parse_errors` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.header_parsing.parse_errors` | Counter | `{parse_error}` | Number of errors that occurred when parsing HTTP request headers. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.header_parsing.header.name` | string | The header name. | `Content-Type` | Always +`error.type` | string | The error message. | `Unable to parse media type value.` | Always + +### Metric: `aspnetcore.header_parsing.cache_accesses` + +The metric is emitted only for HTTP request header parsers that support caching. + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.header_parsing.cache_accesses` | Counter | `{cache_access}` | Number of times a cache storing parsed header values was accessed. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.header_parsing.header.name` | string | The header name. | `Content-Type` | Always +`aspnetcore.header_parsing.cache_access.type` | string | A value indicating whether the header's value was found in the cache or not. | `Hit`; `Miss` | Always + +## `Microsoft.AspNetCore.Server.Kestrel` + +The `Microsoft.AspNetCore.Server.Kestrel` metrics report HTTP connection information from [ASP.NET Core Kestrel web server](/aspnet/core/fundamentals/servers/kestrel): + +* [`kestrel.active_connections`](#metric-kestrelactive_connections) +* [`kestrel.connection.duration`](#metric-kestrelconnectionduration) +* [`kestrel.rejected_connections`](#metric-kestrelrejected_connections) +* [`kestrel.queued_connections`](#metric-kestrelqueued_connections) +* [`kestrel.queued_requests`](#metric-kestrelqueued_requests) +* [`kestrel.upgraded_connections`](#metric-kestrelupgraded_connections) +* [`kestrel.tls_handshake.duration`](#metric-kestreltls_handshakeduration) +* [`kestrel.active_tls_handshakes`](#metric-kestrelactive_tls_handshakes) + +### Metric: `kestrel.active_connections` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.active_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelactive_connections) | UpDownCounter | `{connection}` | Number of connections that are currently active on the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type`| string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port`| int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. + +### Metric: `kestrel.connection.duration` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.connection.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelconnectionduration) | Histogram | `s` | The duration of connections on the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`error.type` | string | Describes a type of error the connection ended with, or the unhandled exception type thrown during the connection pipeline. Known connection errors can be found at [Semantic Conventions for Kestrel web server metrics](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/). | `connection_reset`; `invalid_request_headers`; `System.OperationCanceledException` | If the connection ended with a known error or an exception was thrown. +`network.protocol.name` | string | [OSI application layer](https://www.geeksforgeeks.org/application-layer-in-osi-model/) or non-OSI equivalent. | `http`; `web_sockets` | Always +`network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `1.1`; `2` | Always +`network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. +`tls.protocol.version` | string | TLS protocol version. | `1.2`; `1.3` | If the connection is secured with TLS. + +As this metric is tracking the connection duration, and ideally http connections are used for multiple requests, the buckets should be longer than those used for request durations. For example, using [ 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300] provides an upper bucket of 5 mins. + +:::moniker range="= aspnetcore-9.0" + +When a connection ends with a known error, the `error.type` attribute value is set to the known error type. Known connection errors can be found at [Semantic Conventions for Kestrel web server metrics](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/). + +:::moniker-end + +### Metric: `kestrel.rejected_connections` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.rejected_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelrejected_connections) | Counter | `{connection}` | Number of connections rejected by the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`network.transport`| string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address`| string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. + +Connections are rejected when the currently active count exceeds the value configured with `MaxConcurrentConnections`. + +### Metric: `kestrel.queued_connections` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.queued_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelqueued_connections) | UpDownCounter | `{connection}` | Number of connections that are currently queued and are waiting to start. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. + +### Metric: `kestrel.queued_requests` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.queued_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelqueued_requests) | UpDownCounter | `{request}` | Number of HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are currently queued and are waiting to start. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`network.protocol.name` | string | [OSI application layer](https://www.geeksforgeeks.org/application-layer-in-osi-model/) or non-OSI equivalent. | `http`; `web_sockets` | Always +`network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `1.1`; `2` | Always +`network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. + +### Metric: `kestrel.upgraded_connections` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.upgraded_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelupgraded_connections) | UpDownCounter | `{connection}` | Number of connections that are currently upgraded (WebSockets). + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. + +The counter only tracks HTTP/1.1 connections. + +### Metric: `kestrel.tls_handshake.duration` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.tls_handshake.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestreltls_handshakeduration) | Histogram | `s` | The duration of TLS handshakes on the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`error.type` | string | The full name of exception type. | `System.OperationCanceledException`; `Contoso.MyException` | If an exception was thrown. +`network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. +`tls.protocol.version` | string | TLS protocol version. | `1.2`; `1.3` | If the connection is secured with TLS. + +When using OpenTelemetry, the default buckets for this metic are set to [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]. + +### Metric: `kestrel.active_tls_handshakes` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`kestrel.active_tls_handshakes`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelactive_tls_handshakes) | UpDownCounter | `{handshake}` | Number of TLS handshakes that are currently in progress on the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always +`network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. +`server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always +`server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. + +## `Microsoft.AspNetCore.Http.Connections` + +The `Microsoft.AspNetCore.Http.Connections` metrics report connection information from [ASP.NET Core SignalR](/aspnet/core/signalr/introduction): + +* [`signalr.server.connection.duration`](#metric-signalrserverconnectionduration) +* [`signalr.server.active_connections`](#metric-signalrserveractive_connections) + +### Metric: `signalr.server.connection.duration` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`signalr.server.connection.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-signalr-metrics/#metric-signalrserverconnectionduration) | Histogram | `s` | The duration of connections on the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`signalr.connection.status` | string | SignalR HTTP connection closure status. | `app_shutdown`; `timeout` | Always +`signalr.transport` | string | [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) | `web_sockets`; `long_polling` | Always + +Value | Description +--- | --- +`normal_closure` | The connection was closed normally. +`timeout` | The connection was closed due to a timeout. +`app_shutdown` | The connection was closed because the app is shutting down. + +`signalr.transport` is one of the following: + +Value | Description +--- | --- +`server_sent_events` | [server-sent events](https://developer.mozilla.org/docs/Web/API/Server-sent_events/Using_server-sent_events) +`long_polling` | [Long Polling](/archive/msdn-magazine/2012/april/cutting-edge-long-polling-and-signalr) +`web_sockets` | [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) + +As this metric is tracking the connection duration, and ideally SignalR connections are durable, the buckets should be longer than those used for request durations. For example, using [0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300] provides an upper bucket of 5 mins. + +### Metric: `signalr.server.active_connections` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +[`signalr.server.active_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-signalr-metrics/#metric-signalrserveractive_connections) | UpDownCounter | `{connection}` | Number of connections that are currently active on the server. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`signalr.connection.status` | string | SignalR HTTP connection closure status. | `app_shutdown`; `timeout` | Always +`signalr.transport` | string | [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) | `web_sockets`; `long_polling` | Always + +:::moniker range=">= aspnetcore-10.0" + +## `Microsoft.AspNetCore.Authorization` + +The `Microsoft.AspNetCore.Authorization` metrics report information about [Authorization attempts](xref:security/authorization/introduction) in ASP.NET Core apps: + +### Metric: `aspnetcore.authorization.attempts` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.authorization.attempts` | Counter | `{request}` | The total number of requests for which authorization was attempted. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`user.is_authenticated` | boolean | Whether the request came from an authenticated user | `true` | `Required` +`aspnetcore.authorization.policy` | string | The name of the authorization policy. | `AtLeast21`; `EmployeeOnly` | `Conditionally required` if an authorization policy is used. +`aspnetcore.authorization.result` | string | Whether the authorization succeeded or failed. | `success`; `failure` | `Conditionally Required` if an exception is not thrown during authorization. +`error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error. + +## `Microsoft.AspNetCore.Authentication` + +The `Microsoft.AspNetCore.Authentication` metrics report information about [Authentication](xref:security/authentication/index) in ASP.NET Core apps: + +* [`aspnetcore.authentication.authenticate.duration`](#metric-aspnetcoreauthenticationauthenticateduration) +* [`aspnetcore.authentication.challenges`](#metric-aspnetcoreauthenticationchallenges) +* [`aspnetcore.authentication.forbids`](#metric-aspnetcoreauthenticationforbids) +* [`aspnetcore.authentication.sign_ins`](#metric-aspnetcoreauthenticationsign_ins) +* [`aspnetcore.authentication.sign_outs`](#metric-aspnetcoreauthenticationsign_outs) + +### Metric: `aspnetcore.authentication.authenticate.duration` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.authentication.authenticate.duration` | Histogram | `s` | The authentication duration for a request. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.authentication.result` | string | The authentication result. | `success`; `failure`; `none`; `_OTHER` | `Conditionally Required` if the request did not end with an error. +`aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error. +`error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if authentication failed or the request. has ended with an error. + +### Metric: `aspnetcore.authentication.challenges` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.authentication.challenges` | Counter | `{request}` | The total number of times a scheme is challenged. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error. +`error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error. + +### Metric: `aspnetcore.authentication.forbids` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.authentication.forbids` | Counter | `{request}` | The total number of times an authenticated user attempts to access a resource they aren't permitted to access. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error. +`error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error. + +### Metric: `aspnetcore.authentication.sign_ins` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.authentication.sign_ins` | Counter | `{request}` | The total number of times a principal is signed in with a scheme. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error. +`error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error. + +### Metric: `aspnetcore.authentication.sign_outs` + +Name | Instrument Type | Unit (UCUM) | Description +--- | --- | --- | --- +`aspnetcore.authentication.sign_outs` | Counter | `{request}` | The total number of times a principal is signed out with a scheme. + +Attribute | Type | Description | Examples | Presence +--- | --- | --- | --- | --- +`aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error. +`error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error. -[!INCLUDE[](~/log-mon/metrics/built-in/includes/built-in8.md)] \ No newline at end of file +:::moniker-end diff --git a/aspnetcore/log-mon/metrics/built-in/includes/built-in10.md b/aspnetcore/log-mon/metrics/built-in/includes/built-in10.md deleted file mode 100644 index 6002dc203f5e..000000000000 --- a/aspnetcore/log-mon/metrics/built-in/includes/built-in10.md +++ /dev/null @@ -1,583 +0,0 @@ -:::moniker range=">= aspnetcore-10.0" - -This article describes the metrics built-in for ASP.NET Core produced using the - API. For a listing of metrics based on the older [EventCounters](/dotnet/core/diagnostics/event-counters) API, see [Available counters](/dotnet/core/diagnostics/available-counters). - -For information about how to collect, report, enrich, and test ASP.NET Core metrics, see . - -## `Microsoft.AspNetCore.Components` - -The `Microsoft.AspNetCore.Components` metrics report information on Razor component route changes and browser events: - -* [`aspnetcore.components.navigation`](#metric-aspnetcorecomponentsnavigation) -* [`aspnetcore.components.event_handler`](#metric-aspnetcorecomponentsevent_handler) - -#### Metric: `aspnetcore.components.navigation` - -Name | Instrument Type | Unit (UCUM) | Description ---- | --- | --- | --- -`aspnetcore.components.navigation` | Counter | `{route}` | Tracks the total number of route changes in the app. - -Attribute | Type | Description | Examples | Presence ---- | --- | --- | --- | --- -`aspnetcore.components.type` | string | Component navigated to. | `TestComponent` | Always -`aspnetcore.components.route` | string | The component's route. | `/test-route` | Always - -#### Metric: `aspnetcore.components.event_handler` - -Name | Instrument Type | Unit (UCUM) | Description ---- | --- | --- | --- -`aspnetcore.components.event_handler` | Histogram | `s` | Measures the duration of processing browser events, including business logic. - -Attribute | Type | Description | Examples | Presence ---- | --- | --- | --- | --- -`aspnetcore.components.type` | string | Component type handling the event. | `TestComponent` | Always -`aspnetcore.components.method` | string | C# method handling the event. | `OnClick` | Always -`aspnetcore.components.attribute.name` | string | Component attribute name handling the event. | `onclick` | Always -`error.type` | string | The full name of exception type. | `System.InvalidOperationException`; `Contoso.MyException` | If an exception is thrown. - -## `Microsoft.AspNetCore.Components.Lifecycle` - -The `Microsoft.AspNetCore.Components.Lifecycle` metrics report information on Razor component lifecycle events: - -* [`aspnetcore.components.update_parameters`](#metric-aspnetcorecomponentsupdate_parameters) -* [`aspnetcore.components.render_diff`](#metric-aspnetcorecomponentsrender_diff) - -#### Metric: `aspnetcore.components.update_parameters` - -Name | Instrument Type | Unit (UCUM) | Description ---- | --- | --- | --- -`aspnetcore.components.update_parameters` | Histogram | `s` | Measures the duration of processing component parameters, including business logic. - -Attribute | Type | Description | Examples | Presence ---- | --- | --- | --- | --- -`aspnetcore.components.type` | string | Component type handling the event. | `TestComponent` | Always -`error.type` | string | The full name of exception type. | `System.InvalidOperationException`; `Contoso.MyException` | If an exception is thrown. - -#### Metric: `aspnetcore.components.render_diff` - -Name | Instrument Type | Unit (UCUM) | Description ---- | --- | --- | --- -`aspnetcore.components.render_diff` | Histogram | `s` | Tracks the duration of rendering batches. - -Attribute | Type | Description | Examples | Presence ---- | --- | --- | --- | --- -`aspnetcore.components.diff.length` | int | The length of the render diff. | 50 | Always -`error.type` | string | The full name of exception type. | `System.InvalidOperationException`; `Contoso.MyException` | If an exception is thrown. - -## `Microsoft.AspNetCore.Components.Server.Circuits` - -The `Microsoft.AspNetCore.Components.Server.Circuits` metrics report information on server-side Blazor circuits in Blazor Server and Blazor Web Apps: - -* [`aspnetcore.components.circuit.active`](#metric-aspnetcorecomponentscircuitactive) -* [`aspnetcore.components.circuit.connected`](#metric-aspnetcorecomponentscircuitconnected) -* [`aspnetcore.components.circuit.duration`](#metric-aspnetcorecomponentscircuitduration) - -#### Metric: `aspnetcore.components.circuit.active` - -Name | Instrument Type | Unit (UCUM) | Description ---- | --- | --- | --- -`aspnetcore.components.circuit.active` | UpDownCounter | `{circuit}` | Shows the number of active circuits currently in memory. - -#### Metric: `aspnetcore.components.circuit.connected` - -Name | Instrument Type | Unit (UCUM) | Description ---- | --- | --- | --- -`aspnetcore.components.circuit.connected` | UpDownCounter | `{circuit}` | Tracks the number of circuits connected to clients. - -#### Metric: `aspnetcore.components.circuit.duration` - -Name | Instrument Type | Unit (UCUM) | Description ---- | --- | --- | --- -`aspnetcore.components.circuit.duration` | Histogram | `s` | Measures circuit lifetime duration and provides total circuit count. - -## `Microsoft.AspNetCore.Hosting` - -The `Microsoft.AspNetCore.Hosting` metrics report high-level information about HTTP requests received by ASP.NET Core: - -* [`http.server.request.duration`](#metric-httpserverrequestduration) -* [`http.server.active_requests`](#metric-httpserveractive_requests) - -#### Metric: `http.server.request.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`http.server.request.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-http-metrics/#metric-httpclientrequestduration) | Histogram | `s` | Measures the duration of inbound HTTP requests. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `http.route` | string | The matched route. | `{controller}/{action}/`
`{id?}`| If it's available. | -| `error.type` | string | Describes a class of error the operation ended with. | `timeout`; `name_resolution_error`; `500` | If request has ended with an error. | -| `http.request.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | Always | -| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If one was sent. | -| `network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `3.1.1` | Always | -| `url.scheme` | string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Always | -| `aspnetcore.request.is_unhandled` | Boolean | True when the request wasn't handled by the application pipeline. | `true` | If the request was unhandled. | - -The time used to handle an inbound HTTP request as measured at the hosting layer of ASP.NET Core. The time measurement starts once the underlying web host has: - -* Sufficiently parsed the HTTP request headers on the inbound network stream to identify the new request. -* Initialized the context data structures such as the . - -The time ends when: - -* The ASP.NET Core handler pipeline is finished executing. -* All response data has been sent. -* The context data structures for the request are being disposed. - -When using OpenTelemetry, the default buckets for this metric are set to [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]. - -#### Metric: `http.server.active_requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`http.server.active_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-http-metrics/#metric-httpclientactive_requests) | UpDownCounter | `{request}` | Measures the number of concurrent HTTP requests that are currently in-flight. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `http.request.method` | string | HTTP request method. [1] | `GET`; `POST`; `HEAD` | Always | -| `url.scheme`| string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Always | - -. - -## `Microsoft.AspNetCore.Routing` - -The `Microsoft.AspNetCore.Routing` metrics report information about [routing HTTP requests](/aspnet/core/fundamentals/routing) to ASP.NET Core endpoints: - -* [`aspnetcore.routing.match_attempts`](#metric-aspnetcoreroutingmatch_attempts) - -#### Metric: `aspnetcore.routing.match_attempts` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.routing.match_attempts`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcoreroutingmatch_attempts) | Counter | `{match_attempt}` | Number of requests that were attempted to be matched to an endpoint. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.routing.match_status` | string | Match result | `success`; `failure` | Always | -| `aspnetcore.routing.is_fallback_route` | boolean | A value that indicates whether the matched route is a fallback route. | `True` | If a route was successfully matched. | -| `http.route` | string | The matched route | `{controller}/{action}/`
`{id?}` | If a route was successfully matched. | - -. - -## `Microsoft.AspNetCore.Diagnostics` - -The `Microsoft.AspNetCore.Diagnostics` metrics report diagnostics information from [ASP.NET Core error handling middleware](/aspnet/core/fundamentals/error-handling): - -* [`aspnetcore.diagnostics.exceptions`](#metric-aspnetcorediagnosticsexceptions) - -#### Metric: `aspnetcore.diagnostics.exceptions` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.diagnostics.exceptions`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorediagnosticsexceptions) | Counter | `{exception}` | Number of exceptions caught by exception handling middleware. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.diagnostics.exception.result` | string | ASP.NET Core exception middleware handling result | `handled`; `unhandled` | Always | -| `aspnetcore.diagnostics.handler.type` | string | Full type name of the [`IExceptionHandler`](/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception. | `Contoso.MyHandler` | If the exception was handled by this handler. | -| `exception.type` | string | The full name of exception type. | `System.OperationCanceledException`; `Contoso.MyException` | Always | - -. - -## `Microsoft.AspNetCore.RateLimiting` - -The `Microsoft.AspNetCore.RateLimiting` metrics report rate limiting information from [ASP.NET Core rate-limiting middleware](/aspnet/core/performance/rate-limit): - -* [`aspnetcore.rate_limiting.active_request_leases`](#metric-aspnetcorerate_limitingactive_request_leases) -* [`aspnetcore.rate_limiting.request_lease.duration`](#metric-aspnetcorerate_limitingrequest_leaseduration) -* [`aspnetcore.rate_limiting.queued_requests`](#metric-aspnetcorerate_limitingqueued_requests) -* [`aspnetcore.rate_limiting.request.time_in_queue`](#metric-aspnetcorerate_limitingrequesttime_in_queue) -* [`aspnetcore.rate_limiting.requests`](#metric-aspnetcorerate_limitingrequests) - -#### Metric: `aspnetcore.rate_limiting.active_request_leases` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.active_request_leases`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingactive_request_leases) | UpDownCounter | `{request}` | Number of requests that are currently active on the server that hold a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | - -. - -#### Metric: `aspnetcore.rate_limiting.request_lease.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.request_lease.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequest_leaseduration) | Histogram | `s` | The duration of the rate limiting lease held by requests on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | - -. - -#### Metric: `aspnetcore.rate_limiting.queued_requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.queued_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingqueued_requests) | UpDownCounter | `{request}` | Number of requests that are currently queued waiting to acquire a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | - -. - -#### Metric: `aspnetcore.rate_limiting.request.time_in_queue` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.request.time_in_queue`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequesttime_in_queue) | Histogram | `s` | The time a request spent in a queue waiting to acquire a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | -| `aspnetcore.rate_limiting.result` | string | The rate limiting result shows whether lease was acquired or contains a rejection reason. | `acquired`; `request_canceled` | Always | - -. - -#### Metric: `aspnetcore.rate_limiting.requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequests) | Counter | `{request}` | Number of requests that tried to acquire a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | -| `aspnetcore.rate_limiting.result` | string | The rate limiting result shows whether lease was acquired or contains a rejection reason. | `acquired`; `request_canceled` | Always | - -. - -## `Microsoft.AspNetCore.HeaderParsing` - -The `Microsoft.AspNetCore.HeaderParsing` metrics report information about [ASP.NET Core header parsing](https://www.nuget.org/packages/Microsoft.AspNetCore.HeaderParsing): - -* [`aspnetcore.header_parsing.parse_errors`](#metric-aspnetcoreheader_parsingparse_errors) -* [`aspnetcore.header_parsing.cache_accesses`](#metric-aspnetcoreheader_parsingcache_accesses) - -#### Metric: `aspnetcore.header_parsing.parse_errors` - -| Name | Instrument Type | Unit (UCUM) | Description | -|--|--|--|--| -| `aspnetcore.header_parsing.parse_errors` | Counter | `{parse_error}` | Number of errors that occurred when parsing HTTP request headers. | - -| Attribute | Type | Description | Examples | Presence | -|--|--|--|--|--| -| `aspnetcore.header_parsing.header.name` | string | The header name. | `Content-Type` | Always | -| `error.type` | string | The error message. | `Unable to parse media type value.` | Always | - -. - -#### Metric: `aspnetcore.header_parsing.cache_accesses` - -The metric is emitted only for HTTP request header parsers that support caching. - -| Name | Instrument Type | Unit (UCUM) | Description | -| ---- | --------------- | ----------- | ----------- | -| `aspnetcore.header_parsing.cache_accesses` | Counter | `{cache_access}` | Number of times a cache storing parsed header values was accessed. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.header_parsing.header.name` | string | The header name. | `Content-Type` | Always | -| `aspnetcore.header_parsing.cache_access.type` | string | A value indicating whether the header's value was found in the cache or not. | `Hit`; `Miss` | Always | - -. - -## `Microsoft.AspNetCore.Server.Kestrel` - -The `Microsoft.AspNetCore.Server.Kestrel` metrics report HTTP connection information from [ASP.NET Core Kestrel web server](/aspnet/core/fundamentals/servers/kestrel): - -* [`kestrel.active_connections`](#metric-kestrelactive_connections) -* [`kestrel.connection.duration`](#metric-kestrelconnectionduration) -* [`kestrel.rejected_connections`](#metric-kestrelrejected_connections) -* [`kestrel.queued_connections`](#metric-kestrelqueued_connections) -* [`kestrel.queued_requests`](#metric-kestrelqueued_requests) -* [`kestrel.upgraded_connections`](#metric-kestrelupgraded_connections) -* [`kestrel.tls_handshake.duration`](#metric-kestreltls_handshakeduration) -* [`kestrel.active_tls_handshakes`](#metric-kestrelactive_tls_handshakes) - -#### Metric: `kestrel.active_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.active_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelactive_connections) | UpDownCounter | `{connection}` | Number of connections that are currently active on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type`| string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port`| int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -. - -#### Metric: `kestrel.connection.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.connection.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelconnectionduration) | Histogram | `s` | The duration of connections on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `error.type` | string | Describes a type of error the connection ended with, or the unhandled exception type thrown during the connection pipeline. Known connection errors can be found at [Semantic Conventions for Kestrel web server metrics](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/). | `connection_reset`; `invalid_request_headers`; `System.OperationCanceledException` | If the connection ended with a known error or an exception was thrown. | -| `network.protocol.name` | string | [OSI application layer](https://www.geeksforgeeks.org/application-layer-in-osi-model/) or non-OSI equivalent. | `http`; `web_sockets` | Always | -| `network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `1.1`; `2` | Always | -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | -| `tls.protocol.version` | string | TLS protocol version. | `1.2`; `1.3` | If the connection is secured with TLS. | - -As this metric is tracking the connection duration, and ideally http connections are used for multiple requests, the buckets should be longer than those used for request durations. For example, using [ 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300] provides an upper bucket of 5 mins. - -When a connection ends with a known error, the `error.type` attribute value is set to the known error type. Known connection errors can be found at [Semantic Conventions for Kestrel web server metrics](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/). - -#### Metric: `kestrel.rejected_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.rejected_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelrejected_connections) | Counter | `{connection}` | Number of connections rejected by the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport`| string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address`| string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -Connections are rejected when the currently active count exceeds the value configured with `MaxConcurrentConnections`. - -. - -#### Metric: `kestrel.queued_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.queued_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelqueued_connections) | UpDownCounter | `{connection}` | Number of connections that are currently queued and are waiting to start. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -. - -#### Metric: `kestrel.queued_requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.queued_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelqueued_requests) | UpDownCounter | `{request}` | Number of HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are currently queued and are waiting to start. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.protocol.name` | string | [OSI application layer](https://www.geeksforgeeks.org/application-layer-in-osi-model/) or non-OSI equivalent. | `http`; `web_sockets` | Always | -| `network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `1.1`; `2` | Always | -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -. - -#### Metric: `kestrel.upgraded_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.upgraded_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelupgraded_connections) | UpDownCounter | `{connection}` | Number of connections that are currently upgraded (WebSockets). | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -The counter only tracks HTTP/1.1 connections. - -. - -#### Metric: `kestrel.tls_handshake.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.tls_handshake.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestreltls_handshakeduration) | Histogram | `s` | The duration of TLS handshakes on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `error.type` | string | The full name of exception type. | `System.OperationCanceledException`; `Contoso.MyException` | If an exception was thrown. | -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | -| `tls.protocol.version` | string | TLS protocol version. | `1.2`; `1.3` | If the connection is secured with TLS. | - -When using OpenTelemetry, the default buckets for this metic are set to [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]. - -. - -#### Metric: `kestrel.active_tls_handshakes` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.active_tls_handshakes`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelactive_tls_handshakes) | UpDownCounter | `{handshake}` | Number of TLS handshakes that are currently in progress on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -. - -## `Microsoft.AspNetCore.Http.Connections` - -The `Microsoft.AspNetCore.Http.Connections` metrics report connection information from [ASP.NET Core SignalR](/aspnet/core/signalr/introduction): - -* [`signalr.server.connection.duration`](#metric-signalrserverconnectionduration) -* [`signalr.server.active_connections`](#metric-signalrserveractive_connections) - -#### Metric: `signalr.server.connection.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`signalr.server.connection.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-signalr-metrics/#metric-signalrserverconnectionduration) | Histogram | `s` | The duration of connections on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `signalr.connection.status` | string | SignalR HTTP connection closure status. | `app_shutdown`; `timeout` | Always | -| `signalr.transport` | string | [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) | `web_sockets`; `long_polling` | Always | - -. - -| Value | Description | -|---|---| -| `normal_closure` | The connection was closed normally. | -| `timeout` | The connection was closed due to a timeout. | -| `app_shutdown` | The connection was closed because the app is shutting down. | - -`signalr.transport` is one of the following: - -| Value | Protocol | -|---|---| -| `server_sent_events` | [server-sent events](https://developer.mozilla.org/docs/Web/API/Server-sent_events/Using_server-sent_events) | -| `long_polling` | [Long Polling](/archive/msdn-magazine/2012/april/cutting-edge-long-polling-and-signalr) | -| `web_sockets` | [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) | - -As this metric is tracking the connection duration, and ideally SignalR connections are durable, the buckets should be longer than those used for request durations. For example, using [0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300] provides an upper bucket of 5 mins. - -. - -#### Metric: `signalr.server.active_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`signalr.server.active_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-signalr-metrics/#metric-signalrserveractive_connections) | UpDownCounter | `{connection}` | Number of connections that are currently active on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `signalr.connection.status` | string | SignalR HTTP connection closure status. | `app_shutdown`; `timeout` | Always | -| `signalr.transport` | string | [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) | `web_sockets`; `long_polling` | Always | - -. - -## `Microsoft.AspNetCore.Authorization` - -The `Microsoft.AspNetCore.Authorization` metrics report information about [Authorization attempts](xref:security/authorization/introduction) in ASP.NET Core apps: - -#### Metric: `aspnetcore.authorization.attempts` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| `aspnetcore.authorization.attempts` | Counter | `{request}` | The total number of requests for which authorization was attempted. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `user.is_authenticated` | boolean | Whether the request came from an authenticated user | `true` | `Required` | -| `aspnetcore.authorization.policy` | string | The name of the authorization policy. | `AtLeast21`; `EmployeeOnly` | `Conditionally required` if an authorization policy is used | -| `aspnetcore.authorization.result` | string | Whether the authorization succeeded or failed. | `success`; `failure` | `Conditionally Required` if an exception is not thrown during authorization | -| `error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error | - -. - -## `Microsoft.AspNetCore.Authentication` - -The `Microsoft.AspNetCore.Authentication` metrics report information about [Authentication](xref:security/authentication/index) in ASP.NET Core apps: - -- [`aspnetcore.authentication.authenticate.duration`](#metric-aspnetcoreauthenticationauthenticateduration) -- [`aspnetcore.authentication.challenges`](#metric-aspnetcoreauthenticationchallenges) -- [`aspnetcore.authentication.forbids`](#metric-aspnetcoreauthenticationforbids) -- [`aspnetcore.authentication.sign_ins`](#metric-aspnetcoreauthenticationsign_ins) -- [`aspnetcore.authentication.sign_outs`](#metric-aspnetcoreauthenticationsign_outs) - -#### Metric: `aspnetcore.authentication.authenticate.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| `aspnetcore.authentication.authenticate.duration` | Histogram | `s` | The authentication duration for a request. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.authentication.result` | string | The authentication result. | `success`; `failure`; `none`; `_OTHER` | `Conditionally Required` if the request did not end with an error | -| `aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error | -| `error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if authentication failed or the request has ended with an error | - -. - -#### Metric: `aspnetcore.authentication.challenges` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| `aspnetcore.authentication.challenges` | Counter | `{request}` | The total number of times a scheme is challenged. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error | -| `error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error | - -. - -#### Metric: `aspnetcore.authentication.forbids` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| `aspnetcore.authentication.forbids` | Counter | `{request}` | The total number of times an authenticated user attempts to access a resource they aren't permitted to access. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error | -| `error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error | - -. - -#### Metric: `aspnetcore.authentication.sign_ins` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| `aspnetcore.authentication.sign_ins` | Counter | `{request}` | The total number of times a principal is signed in with a scheme. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error | -| `error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error | - -. - -#### Metric: `aspnetcore.authentication.sign_outs` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| `aspnetcore.authentication.sign_outs` | Counter | `{request}` | The total number of times a principal is signed out with a scheme. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.authentication.scheme` | string | The name of the authentication scheme. | `Bearer`; `Cookies` | `Conditionally Required` if the request did not end with an error | -| `error.type` | string | The full name of the exception type. | `System.InvalidOperationException`; `Contoso.MyException` | `Conditionally Required` if the request has ended with an error | - -:::moniker-end diff --git a/aspnetcore/log-mon/metrics/built-in/includes/built-in8.md b/aspnetcore/log-mon/metrics/built-in/includes/built-in8.md deleted file mode 100644 index d873975caba0..000000000000 --- a/aspnetcore/log-mon/metrics/built-in/includes/built-in8.md +++ /dev/null @@ -1,373 +0,0 @@ -:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0" - -This article describes the metrics built-in for ASP.NET Core produced using the - API. For a listing of metrics based on the older [EventCounters](/dotnet/core/diagnostics/event-counters) API, -see [Available counters](/dotnet/core/diagnostics/available-counters). - -> [!TIP] -> For more information about how to collect, report, enrich, and test ASP.NET Core metrics, see [Using ASP.NET Core metrics](xref:log-mon/metrics/metrics). - -## `Microsoft.AspNetCore.Hosting` - -The `Microsoft.AspNetCore.Hosting` metrics report high-level information about HTTP requests received by ASP.NET Core: - -* [`http.server.request.duration`](#metric-httpserverrequestduration) -* [`http.server.active_requests`](#metric-httpserveractive_requests) - -##### Metric: `http.server.request.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`http.server.request.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-http-metrics/#metric-httpclientrequestduration) | Histogram | `s` | Measures the duration of inbound HTTP requests. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `http.route` | string | The matched route. | `{controller}/{action}/{id?}` | If it's available. | -| `error.type` | string | Describes a class of error the operation ended with. | `timeout`; `name_resolution_error`; `500` | If request has ended with an error. | -| `http.request.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | Always | -| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If one was sent. | -| `network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `3.1.1` | Always | -| `url.scheme` | string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Always | -| `aspnetcore.request.is_unhandled` | Boolean | True when the request wasn't handled by the application pipeline. | `true` | If the request was unhandled. | - -The time used to handle an inbound HTTP request as measured at the hosting layer of ASP.NET Core. The time measurement starts once the underlying web host has: - -* Sufficiently parsed the HTTP request headers on the inbound network stream to identify the new request. -* Initialized the context data structures such as the . - -The time ends when: - -* The ASP.NET Core handler pipeline is finished executing. -* All response data has been sent. -* The context data structures for the request are being disposed. - -When using OpenTelemetry, the default buckets for this metric are set to [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]. - -##### Metric: `http.server.active_requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`http.server.active_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-http-metrics/#metric-httpclientactive_requests) | UpDownCounter | `{request}` | Measures the number of concurrent HTTP requests that are currently in-flight. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `http.request.method` | string | HTTP request method. [1] | `GET`; `POST`; `HEAD` | Always | -| `url.scheme`| string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Always | - -## `Microsoft.AspNetCore.Routing` - -The `Microsoft.AspNetCore.Routing` metrics report information about [routing HTTP requests](/aspnet/core/fundamentals/routing) to ASP.NET Core endpoints: - -* [`aspnetcore.routing.match_attempts`](#metric-aspnetcoreroutingmatch_attempts) - -##### Metric: `aspnetcore.routing.match_attempts` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.routing.match_attempts`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcoreroutingmatch_attempts) | Counter | `{match_attempt}` | Number of requests that were attempted to be matched to an endpoint. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.routing.match_status` | string | Match result | `success`; `failure` | Always | -| `aspnetcore.routing.is_fallback_route` | boolean | A value that indicates whether the matched route is a fallback route. | `True` | If a route was successfully matched. | -| `http.route` | string | The matched route | `{controller}/{action}/{id?}` | If a route was successfully matched. | - -## `Microsoft.AspNetCore.Diagnostics` - -The `Microsoft.AspNetCore.Diagnostics` metrics report diagnostics information from [ASP.NET Core error handling middleware](/aspnet/core/fundamentals/error-handling): -* [`aspnetcore.diagnostics.exceptions`](#metric-aspnetcorediagnosticsexceptions) - -##### Metric: `aspnetcore.diagnostics.exceptions` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.diagnostics.exceptions`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorediagnosticsexceptions) | Counter | `{exception}` | Number of exceptions caught by exception handling middleware. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.diagnostics.exception.result` | string | ASP.NET Core exception middleware handling result | `handled`; `unhandled` | Always | -| `aspnetcore.diagnostics.handler.type` | string | Full type name of the [`IExceptionHandler`](/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception. | `Contoso.MyHandler` | If the exception was handled by this handler. | -| `exception.type` | string | The full name of exception type. | `System.OperationCanceledException`; `Contoso.MyException` | Always | - -## `Microsoft.AspNetCore.RateLimiting` - -The `Microsoft.AspNetCore.RateLimiting` metrics report rate limiting information from [ASP.NET Core rate-limiting middleware](/aspnet/core/performance/rate-limit): - -* [`aspnetcore.rate_limiting.active_request_leases`](#metric-aspnetcorerate_limitingactive_request_leases) -* [`aspnetcore.rate_limiting.request_lease.duration`](#metric-aspnetcorerate_limitingrequest_leaseduration) -* [`aspnetcore.rate_limiting.queued_requests`](#metric-aspnetcorerate_limitingqueued_requests) -* [`aspnetcore.rate_limiting.request.time_in_queue`](#metric-aspnetcorerate_limitingrequesttime_in_queue) -* [`aspnetcore.rate_limiting.requests`](#metric-aspnetcorerate_limitingrequests) - -##### Metric: `aspnetcore.rate_limiting.active_request_leases` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.active_request_leases`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingactive_request_leases) | UpDownCounter | `{request}` | Number of requests that are currently active on the server that hold a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | - -##### Metric: `aspnetcore.rate_limiting.request_lease.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.request_lease.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequest_leaseduration) | Histogram | `s` | The duration of the rate limiting lease held by requests on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | - -##### Metric: `aspnetcore.rate_limiting.queued_requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.queued_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingqueued_requests) | UpDownCounter | `{request}` | Number of requests that are currently queued waiting to acquire a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | - -##### Metric: `aspnetcore.rate_limiting.request.time_in_queue` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.request.time_in_queue`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequesttime_in_queue) | Histogram | `s` | The time a request spent in a queue waiting to acquire a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | -| `aspnetcore.rate_limiting.result` | string | The rate limiting result shows whether lease was acquired or contains a rejection reason. | `acquired`; `request_canceled` | Always | - -##### Metric: `aspnetcore.rate_limiting.requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`aspnetcore.rate_limiting.requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-aspnetcore-metrics/#metric-aspnetcorerate_limitingrequests) | Counter | `{request}` | Number of requests that tried to acquire a rate limiting lease. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.rate_limiting.policy` | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | If the matched endpoint for the request had a rate-limiting policy. | -| `aspnetcore.rate_limiting.result` | string | The rate limiting result shows whether lease was acquired or contains a rejection reason. | `acquired`; `request_canceled` | Always | - -## `Microsoft.AspNetCore.HeaderParsing` - -The `Microsoft.AspNetCore.HeaderParsing` metrics report information about [ASP.NET Core header parsing](https://www.nuget.org/packages/Microsoft.AspNetCore.HeaderParsing): - -* [`aspnetcore.header_parsing.parse_errors`](#metric-aspnetcoreheader_parsingparse_errors) -* [`aspnetcore.header_parsing.cache_accesses`](#metric-aspnetcoreheader_parsingcache_accesses) - -##### Metric: `aspnetcore.header_parsing.parse_errors` - -| Name | Instrument Type | Unit (UCUM) | Description | -|--|--|--|--| -| `aspnetcore.header_parsing.parse_errors` | Counter | `{parse_error}` | Number of errors that occurred when parsing HTTP request headers. | - -| Attribute | Type | Description | Examples | Presence | -|--|--|--|--|--| -| `aspnetcore.header_parsing.header.name` | string | The header name. | `Content-Type` | Always | -| `error.type` | string | The error message. | `Unable to parse media type value.` | Always | - -##### Metric: `aspnetcore.header_parsing.cache_accesses` - -The metric is emitted only for HTTP request header parsers that support caching. - -| Name | Instrument Type | Unit (UCUM) | Description | -| ---- | --------------- | ----------- | ----------- | -| `aspnetcore.header_parsing.cache_accesses` | Counter | `{cache_access}` | Number of times a cache storing parsed header values was accessed. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `aspnetcore.header_parsing.header.name` | string | The header name. | `Content-Type` | Always | -| `aspnetcore.header_parsing.cache_access.type` | string | A value indicating whether the header's value was found in the cache or not. | `Hit`; `Miss` | Always | - -## `Microsoft.AspNetCore.Server.Kestrel` - -The `Microsoft.AspNetCore.Server.Kestrel` metrics report HTTP connection information from [ASP.NET Core Kestrel web server](/aspnet/core/fundamentals/servers/kestrel): - -* [`kestrel.active_connections`](#metric-kestrelactive_connections) -* [`kestrel.connection.duration`](#metric-kestrelconnectionduration) -* [`kestrel.rejected_connections`](#metric-kestrelrejected_connections) -* [`kestrel.queued_connections`](#metric-kestrelqueued_connections) -* [`kestrel.queued_requests`](#metric-kestrelqueued_requests) -* [`kestrel.upgraded_connections`](#metric-kestrelupgraded_connections) -* [`kestrel.tls_handshake.duration`](#metric-kestreltls_handshakeduration) -* [`kestrel.active_tls_handshakes`](#metric-kestrelactive_tls_handshakes) - -##### Metric: `kestrel.active_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.active_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelactive_connections) | UpDownCounter | `{connection}` | Number of connections that are currently active on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type`| string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port`| int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -##### Metric: `kestrel.connection.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.connection.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelconnectionduration) | Histogram | `s` | The duration of connections on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `error.type` | string | Describes a type of error the connection ended with, or the unhandled exception type thrown during the connection pipeline. Known connection errors can be found at [Semantic Conventions for Kestrel web server metrics](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/). | `connection_reset`; `invalid_request_headers`; `System.OperationCanceledException` | If the connection ended with a known error or an exception was thrown. | -| `network.protocol.name` | string | [OSI application layer](https://www.geeksforgeeks.org/application-layer-in-osi-model/) or non-OSI equivalent. | `http`; `web_sockets` | Always | -| `network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `1.1`; `2` | Always | -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | -| `tls.protocol.version` | string | TLS protocol version. | `1.2`; `1.3` | If the connection is secured with TLS. | - -As this metric is tracking the connection duration, and ideally http connections are used for multiple requests, the buckets should be longer than those used for request durations. For example, using [ 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300] provides an upper bucket of 5 mins. - -:::moniker-end - -:::moniker range="= aspnetcore-9.0" - -When a connection ends with a known error, the `error.type` attribute value is set to the known error type. Known connection errors can be found at [Semantic Conventions for Kestrel web server metrics](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/). - -:::moniker-end - -:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0" - -##### Metric: `kestrel.rejected_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.rejected_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelrejected_connections) | Counter | `{connection}` | Number of connections rejected by the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport`| string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address`| string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -Connections are rejected when the currently active count exceeds the value configured with `MaxConcurrentConnections`. - -##### Metric: `kestrel.queued_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.queued_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelqueued_connections) | UpDownCounter | `{connection}` | Number of connections that are currently queued and are waiting to start. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -##### Metric: `kestrel.queued_requests` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.queued_requests`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelqueued_requests) | UpDownCounter | `{request}` | Number of HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are currently queued and are waiting to start. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.protocol.name` | string | [OSI application layer](https://www.geeksforgeeks.org/application-layer-in-osi-model/) or non-OSI equivalent. | `http`; `web_sockets` | Always | -| `network.protocol.version` | string | Version of the protocol specified in `network.protocol.name`. | `1.1`; `2` | Always | -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -##### Metric: `kestrel.upgraded_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.upgraded_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelupgraded_connections) | UpDownCounter | `{connection}` | Number of connections that are currently upgraded (WebSockets). | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -The counter only tracks HTTP/1.1 connections. - -##### Metric: `kestrel.tls_handshake.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.tls_handshake.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestreltls_handshakeduration) | Histogram | `s` | The duration of TLS handshakes on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `error.type` | string | The full name of exception type. | `System.OperationCanceledException`; `Contoso.MyException` | If an exception was thrown. | -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | -| `tls.protocol.version` | string | TLS protocol version. | `1.2`; `1.3` | If the connection is secured with TLS. | - -When using OpenTelemetry, the default buckets for this metic are set to [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]. - -##### Metric: `kestrel.active_tls_handshakes` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`kestrel.active_tls_handshakes`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-kestrel-metrics/#metric-kestrelactive_tls_handshakes) | UpDownCounter | `{handshake}` | Number of TLS handshakes that are currently in progress on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `network.transport` | string | [OSI transport layer](https://www.geeksforgeeks.org/transport-layer-in-osi-model/) or [inter-process communication method](https://en.wikipedia.org/wiki/Inter-process_communication). | `tcp`; `unix` | Always | -| `network.type` | string | [OSI network layer](https://www.geeksforgeeks.org/network-layer-in-osi-model/) or non-OSI equivalent. | `ipv4`; `ipv6` | If the transport is `tcp` or `udp`. | -| `server.address` | string | Server address domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. | `example.com` | Always | -| `server.port` | int | Server port number | `80`; `8080`; `443` | If the transport is `tcp` or `udp`. | - -## `Microsoft.AspNetCore.Http.Connections` - -The `Microsoft.AspNetCore.Http.Connections` metrics report connection information from [ASP.NET Core SignalR](/aspnet/core/signalr/introduction): - -* [`signalr.server.connection.duration`](#metric-signalrserverconnectionduration) -* [`signalr.server.active_connections`](#metric-signalrserveractive_connections) - -##### Metric: `signalr.server.connection.duration` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`signalr.server.connection.duration`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-signalr-metrics/#metric-signalrserverconnectionduration) | Histogram | `s` | The duration of connections on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `signalr.connection.status` | string | SignalR HTTP connection closure status. | `app_shutdown`; `timeout` | Always | -| `signalr.transport` | string | [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) | `web_sockets`; `long_polling` | Always | - -| Value | Description | -|---|---| -| `normal_closure` | The connection was closed normally. | -| `timeout` | The connection was closed due to a timeout. | -| `app_shutdown` | The connection was closed because the app is shutting down. | - -`signalr.transport` is one of the following: - -| Value | Protocol | -|---|---| -| `server_sent_events` | [server-sent events](https://developer.mozilla.org/docs/Web/API/Server-sent_events/Using_server-sent_events) | -| `long_polling` | [Long Polling](/archive/msdn-magazine/2012/april/cutting-edge-long-polling-and-signalr) | -| `web_sockets` | [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) | - -As this metric is tracking the connection duration, and ideally SignalR connections are durable, the buckets should be longer than those used for request durations. For example, using [0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300] provides an upper bucket of 5 mins. - -##### Metric: `signalr.server.active_connections` - -| Name | Instrument Type | Unit (UCUM) | Description | -| -------- | --------------- | ----------- | -------------- | -| [`signalr.server.active_connections`](https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-signalr-metrics/#metric-signalrserveractive_connections) | UpDownCounter | `{connection}` | Number of connections that are currently active on the server. | - -| Attribute | Type | Description | Examples | Presence | -|---|---|---|---|---| -| `signalr.connection.status` | string | SignalR HTTP connection closure status. | `app_shutdown`; `timeout` | Always | -| `signalr.transport` | string | [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) | `web_sockets`; `long_polling` | Always | - -:::moniker-end