Description
openedon Apr 6, 2020
AspNetCore SDK 2.8.0 onwards, we were collecting Asp.Net Core EventCounters by default (only on .NET Core 3.0/3.1 app).
Proposing to remove Asp.Net Core counters from the list by default.
The following are the counters collected:
"Request Rate", "Total Requests", "Current Requests", "Failed Requests"
Reasons:
-
All the above counters are already available as Application Insights standard metrics. The AI standard metrics are superior because they have dimensions like Request Status Code. The EventCounter ones don't have any dimensions, so they don't offer any additional value beyond whats available from Standard Metrics.
-
The standard metrics are free of cost for users. The EventCounter metrics are not free, and are subject to ingestion billing based on GBs ingested.
-
In all the latest SDKs Standard metrics are extracted at the SDK side itself, before sampling. Hence its equally good as EventCounters, at getting metric unaffected by sampling or any other telemetry reduction techniques.
Additional reasons, which are really issues about the publishing if counters itself: (will open separate issues in the Asp.Net Core Hosting repo, but listing here for immediate reference)
- "Total Requests", "Current Requests", "Failed Requests" - These 3 counters are published by Asp.Net Core runtime using
PollingCounters
(https://github.com/dotnet/aspnetcore/blob/master/src/Hosting/Hosting/src/Internal/HostingEventSource.cs#L96)
This essentially means that consumers (in our case AI SDK), gets the standard Min,Max,Count,Mean about these counters. However, these counters are values since the start of the process, and hence makes sense to be used only for 'Rates'.
i.e Knowing Total Requests since the start of process is of little value, but the Rates per sec is of value.
Inorder to calculate 'Rates', these counters must be published using IncrementingPollingCounter
, as opposed to PollingCounter
. AI SDK calculates Rates for IncrementingPollingCounter
or IncrementingCounter
only.
- "Request Rate" is published as
IncrementingPollingCounter
which allows SDK to calculate rate. SDK currently calculates per sec rate, which (happened t)o match theDisplayRateTimeScale
of 1 sec suggested by the publisher. This counter alone may be used as such, but standard metric already offer this same metric, in a superior way.