-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Library name and version
Azure.Monitor.OpenTelemetry.AspNetCore 1.3.0
Describe the bug
When using the default configuration for Azure Monitor for OpenTelemetry
builder.Services.AddOpenTelemetry()
.ConfigureResource(r => r.AddService("Playground"))
.UseAzureMonitor();
An excessive amount of metrics items are published to application insights. For a project with a single downstream dependency on Microsoft Graph and around 200 requests per day, this results in over 300,000 'http.client.open_connections' metrics items per day. The issue appears to be that the metrics are dimensioned heavily, so that each combination of remote hostname, remote IP, HTTP protocol and connection state results in an individual telemetry item, and that host/IP combinations which have no active or inactive connections are still reported for the entire lifetime of the application. Meaning that if I make a single HTTP request to a downstream service on app startup, App Insights will record a telemetry item for that one per minute forever, even though I have no remaining connection to that service.

Expected behavior
Metrics such as http.client.open_connections would only be reported when there is at least one active or inactive connection, but not reported if there are no connections.
Actual behavior
Metrics such as http.client.open_connections are reported one per minute even though no connection to the given service exists in any state.
Reproduction Steps
Create a asp.net core web application project and use the default configuration for azure monitor open telemetry:
builder.Services.AddOpenTelemetry()
.ConfigureResource(r => r.AddService("Playground"))
.UseAzureMonitor();
Make a single HTTP request from a controller action, and invoke that action. Observe that app insights 'customMetrics' continues to grow with new metrics for that downstream connection well after the point where the connection no longer exists.
Environment
.net 9.0