Skip to content

Metrics

Patrick Widauer edited this page Jun 19, 2024 · 1 revision

Note

This feature is available in CoreForms version 8.2.0 and higher.

ASP.NET exported a number of metrics using Windows performance counters that provided information about the running application. Much of this logic was implemented in IIS, and was reimplemented in CoreForms. Metrics in CoreForms use System.Diagnostics.Metrics instead of Windows performance counters. This provides a cross-platform friendly implementation and allows developers to use modern telemetry tools like OpenTelemetry.

Important

All the metrics reported by CoreForms only report metrics about the CoreForms pipeline. The metric "Requests Total", for example, will only show the number of requests that were executed in the CoreForms pipeline (.MapLegacyAspNet(...)). Requests to ASP.NET Core Web API, Razor pages, etc. will not change the "Requests Total" metric as they do not execute in the CoreForms pipeline. Depending on your use case, use ASP.NET Core metrics instead.

Installation

CoreForms metrics are exported using the meter named "CoreForms.Web". You can register this meter in the telemetry toolstack of your choice.

For OpenTelemetry, we provide a Nuget packge CoreForms.Web.Infrastructure.OpenTelemetry, which can be used when configuring metrics for OpenTelemetry:

services.AddOpenTelemetry()
  .WithMetrics(builder => 
    builder
      .AddCoreFormsInstrumentation()
      //.AddConsoleExporter()
      //.AddOtlpExporter()
      //.AddAspNetCoreInstrumentation()
    );

ASP.NET Performance Counters

There were three relevant groups of performance counters: "ASP.NET", "ASP.NET Applications", and "ASP.NET State Service". These group names come from the names displayed when selecting the performance counters in the Performance Monitor. The tables below show which performance counters are available in CoreForms. The legend for the supported column is:

  • ✔ metric_name: Supported in CoreForms as the specified metric_name
  • ⚠: Supported but see the "Remarks" column for more information
  • ❌: Not supported. See "Remarks" for reason or why

"ASP.NET" Performance Counter

In ASP.NET, applications were hosted in IIS worker processes, which could host many applications at the same time. Because of this, performance counters were split up into global ("ASP.NET" section) and local ("ASP.NET Applications") sections. This differentiation is obsolete with CoreForms as applications are not longer hosted in IIS worker processes. As such, none of the global performance counters are supported, but there are functioning counterparts for some of the performance counters in the "ASP.NET Applications" section.

Process Counter Name Supported? Remarks
Application Restarts ❌ No automatic application restarts
Applications Running ❌ No longer hosted in IIS worker process
Audit Failure Events Raised ⚠ Use application counterpart in "ASP.NET Applications" below
Audit Success Events Raised ⚠ Use application counterpart in "ASP.NET Applications" below
Error Events Raised ⚠ Use application counterpart in "ASP.NET Applications" below
Infrastructure Error Events Raised ⚠ Use application counterpart in "ASP.NET Applications" below
Request Error Events Raised ⚠ Use application counterpart in "ASP.NET Applications" below
Request Execution Time ⚠ Use application counterpart in "ASP.NET Applications" below
Request Wait Time ⚠ Use application counterpart in "ASP.NET Applications" below
Requests Current ❌ Use ASP.NET Core metrics instead
Requests Disconnected ⚠ Use application counterpart in "ASP.NET Applications" below
Requests In Native Queue ❌ No longer hosted in IIS worker process
Requests Queued ⚠ Use application counterpart "Requests In Application Queue" in "ASP.NET Applications" below
Requests Rejected ⚠ Use application counterpart in "ASP.NET Applications" below
State Server Session Abandoned ❌ Session State server is not supported
State Server Session Active ❌ Session State server is not supported
State Server Session Timed Out ❌ Session State server is not supported
State Server Session Total ❌ Session State server is not supported
Worker Process Restarts ❌ No longer hosted in IIS worker process
Worker Process Running ❌ No longer hosted in IIS worker process

"ASP.NET Applications" Performance Counter

Process Counter Name Supported? Remarks
% Managed Processor Time (estimated) ❌ Use System.Runtime metrics instead
Anonymous Requests ✔ coreforms.anonymous_requests
Anonymous Request/Sec ⚠ Derive from reported metrics
Application Lifetime Events ✔ coreforms.events_app
Application Lifetime Events/Sec ⚠ Derive from reported metrics
Audit Failure Events Raised ✔ coreforms.audit_fail
Audit Success Events Raised ✔ coreforms.audit_success
Cache % Machine Memory Limit Used ❌ Cache size detection does not work in .NET
Cache % Process Memory Limit Used ❌ Cache size detection does not work in .NET
Cache API Entries ✔ coreforms.api_cache_entries
Cache API Hit Ratio ⚠ Can be calculated: coreforms.api_cache_hits / coreforms.api_cache_ratio_base
Cache API Hits ✔ coreforms.api_cache_hits
Cache API Misses ✔ coreforms.api_cache_misses
Cache API Trims ❌ Cache size detection does not work in .NET
Cache API Turnover Rate ✔ coreforms.api_cache_turnover_rate
Cache API Total Entries ✔ coreforms.total_cache_entries
Cache API Total Hit Ratio ⚠ Can be calculated: coreforms.total_cache_hits / coreforms.total_cache_ratio_base
Cache API Total Hits ✔ coreforms.total_cache_hits
Cache API Total Misses ✔ coreforms.total_cache_misses
Cache API Total Trims ❌ Cache size detection does not work in .NET
Cache API Total Turnover Rate ✔ coreforms.total_cache_turnover_rate
Compilations Total ✔ coreforms.compilations
Debugging Requests ✔ coreforms.debugging_requests
Error Events Raised ✔ coreforms.events_error
Error Events Raised/Sec ⚠ Derive from reported metrics
Errors During Compilation ✔ coreforms.errors_compiling
Errors During Execution ✔ coreforms.errors_during_request
Errors During Preprocessing ✔ coreforms.errors_pre_processing
Errors Total ✔ coreforms.errors_total
Errors Total/Sec ⚠ Derive from reported metrics
Errors Unhandled During Execution ✔ coreforms.errors_unhandled
Errors Unhandled During Execution/Sec ⚠ Derive from reported metrics
Events Raised ✔ coreforms.events_total
Events Raised/Sec ⚠ Derive from reported metrics
Forms Authentication Failure ✔ coreforms.forms_auth_fail
Forms Authentication Success ✔ coreforms.forms_auth_success
Infrastructure Error Events Raised ✔ coreforms.events_http_infra_error
Infrastructure Error Events Raised/Sec ⚠ Derive from reported metrics
Managed Memory Used (estimated) ❌ Use System.Runtime metrics instead
Membership Authentication Failure ✔ coreforms.member_fail
Membership Authentication Success ✔ coreforms.member_success
Output Cache Entries ✔ coreforms.output_cache_entries
Output Cache Hit Ratio ⚠ Can be calculated: coreforms.output_cache_hits / coreforms.output_cache_ratio_base
Output Cache Hits ✔ coreforms.output_cache_hits
Output Cache Misses ✔ coreforms.output_cache_misses
Output Cache Trims ❌ Cache size detection does not work in .NET
Output Cache Turnover Rate ✔ coreforms.output_cache_turnover_rate
Pipeline Instance Count ✔ coreforms.pipelines
Request Bytes In Total ✔ coreforms.request_bytes_in
Request Bytes In Total (WebSockets) ❌ ASP.NET Web Sockets are not supported
Request Bytes Out Total ✔ coreforms.request_bytes_out
Request Bytes Out Total (WebSockets) ❌ ASP.NET Web Sockets are not supported
Request Error Events Raised ✔ coreforms.events_http_req_error
Request Error Events Raised/Sec ⚠ Derive from reported metrics
Request Events Raised ✔ coreforms.events_web_req
Request Events Raised/Sec ⚠ Derive from reported metrics
Request Execution Time ✔ coreforms.app_request_exec_time
Request Wait Time ✔ coreforms.app_request_wait_time
Requests Disconnected ✔ coreforms.app_request_disconnected
Requests Executing ✔ coreforms.requests_executing
Requests Executing (WebSockets) ❌ ASP.NET Web Sockets are not supported
Requests Failed ✔ coreforms.requests_failed
Requests Failed (WebSockets) ❌ ASP.NET Web Sockets are not supported
Requests In Application Queue ✔ coreforms.requests_in_application_queue
Requests Not Authorized ✔ coreforms.requests_not_authorized
Requests Not Found ✔ coreforms.requests_not_found
Requests Rejected ✔ coreforms.app_requests_rejected
Requests Succeeded ✔ coreforms.requests_succeded
Requests Succeeded (WebSockets) ❌ ASP.NET Web Sockets are not supported
Requests Timed Out ✔ coreforms.requests_timed_out
Requests Total ✔ coreforms.requests_total
Requests Total (WebSockets) ❌ ASP.NET Web Sockets are not supported
Requests/Sec ⚠ Derive from reported metrics
Session SQL Server connections total ❌ Session State server is not supported
Session State Server connections total ❌ Session State server is not supported
Sessions Abandoned ✔ coreforms.sessions_abandoned
Sessions Active ✔ coreforms.sessions_active
Sessions Timed Out ✔ coreforms.sessions_timed_out
Sessions Total ✔ coreforms.sessions_total
Transactions Aborted ❌ System.EnterpriseServices is not supported in .NET
Transactions Commited ❌ System.EnterpriseServices is not supported in .NET
Transactions Pending ❌ System.EnterpriseServices is not supported in .NET
Transactions Total ❌ System.EnterpriseServices is not supported in .NET
Transactions/Sec ❌ System.EnterpriseServices is not supported in .NET
Viewstate MAC Validation Failure ✔ coreforms.viewstate_mac_fail

"ASP.NET State Service" Performance Counter

The session state server concept is not supported in CoreForms. As such, none of the related performance counters are supported.

Process Counter Name Supported? Remarks
State Server Sessions Abandoned ❌ Session State server is not supported
State Server Sessions Active ❌ Session State server is not supported
State Server Sessions Timed Out ❌ Session State server is not supported
State Server Sessions Total ❌ Session State server is not supported

Clone this wiki locally