Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion docs/core/diagnostics/built-in-metrics-aspnetcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ASP.NET Core metrics
description: Review the metrics available for ASP.NET Core
ms.topic: reference
ms.date: 11/02/2023
ms.date: 2/01/2024
---

# ASP.NET Core metrics
Expand Down Expand Up @@ -48,6 +48,9 @@ The time ends when:
- 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 ].

<!-- Once we migrate this doc to https://github.com/dotnet/AspNetCore.Docs we can remove the following version info -->
Available starting in: .NET 8.0.

##### Metric: `http.server.active_requests`
Expand Down Expand Up @@ -255,6 +258,8 @@ Available starting in: .NET 8.0.
| `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.

Available starting in: .NET 8.0.

##### Metric: `kestrel.rejected_connections`
Expand Down Expand Up @@ -338,6 +343,8 @@ Available starting in: .NET 8.0.
| `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 ].

Available starting in: .NET 8.0.

##### Metric: `kestrel.active_tls_handshakes`
Expand Down Expand Up @@ -375,6 +382,24 @@ The `Microsoft.AspNetCore.Http.Connections` metrics report connection informatio

Available starting in: .NET 8.0.

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

Available starting in: .NET 8.0.

##### Metric: `signalr.server.active_connections`

| Name | Instrument Type | Unit (UCUM) | Description |
Expand Down
6 changes: 6 additions & 0 deletions docs/core/diagnostics/built-in-metrics-system-net.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Most errors when doing a DNS lookup throw a <xref:System.Net.Sockets.SocketExcep

Socket exceptions with any other `SocketError` value are reported as `System.Net.Sockets.SocketException`.

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

Available starting in: .NET 8

## `System.Net.Http`
Expand Down Expand Up @@ -91,6 +93,8 @@ Available starting in: .NET 8

This metric is only captured when <xref:System.Net.Http.HttpClient> is configured to use the default <xref:System.Net.Http.SocketsHttpHandler>.

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.

Available starting in: .NET 8

##### Metric: `http.client.request.duration`
Expand All @@ -111,6 +115,8 @@ Available starting in: .NET 8

HTTP client request duration measures the time the underlying client handler takes to complete the request. Completing the request includes the time up to reading response headers from the network stream. It doesn't include the time spent reading the response body.

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

Available starting in: .NET 8

> [!TIP]
Expand Down