dotnet中的counters说明(二)
上篇说了System.Runtime,它负责应用运行的环境资源的收集,这篇要继续说AspNetCore的Hosting,Http.Connections和Server.Kestrel三个计数器。
同时,下面指标各项()里的项目是--counters 参数[]里的项,用逗号分隔多项指标。
Microsoft.AspNetCore.Hosting计数器本计数器是收集请求的数值,.net core 3.1使用命令:
dotnet-counters monitor -n websample --refresh-interval 1 --counters Microsoft.AspNetCore.Hosting
视图:
指标:
Current Requests (current-requests)当前正在请求的总数
Failed Requests (failed-requests)失败请求总数
Request Rate (requests-per-second)每秒请求数
Total Requests (total-requests)请求总数
Microsoft.AspNetCore.Http.Connections计数器websocket连接的指,.net core 3.1使用
命令:
dotnet-counters monitor -n BlazorAppDemo --refresh-interval 1 --counters Microsoft.AspNetCore.Http.Connections
视图:
指标:Average Connection Duration (connections-duration)连接的平均持续时间(毫秒)
Current Connections (current-connections)当前活动连接数
Total Connections Started (connections-started)已启动的连接总数
Total Connections Stopped (connections-stopped)已停止的连接总数
Total Connections Timed Out (connections-timed-out)已超时的连接总数
Microsoft-AspNetCore-Server-Kestrel计数器对,你没看错,这里不是“.”了,变成“-”了。本指标是关于Kestrel作为host时的收集指标,>=.NET5使用。
命令:
dotnet-counters monitor -n BlazorAppDemo --refresh-interval 1 --counters Microsoft-AspNetCore-Server-Kestrel
视图:
指标:Connection Queue Length (connection-queue-length)当前连接队列的长度
Connection Rate (connections-per-second)每秒连接数
Current Connections (current-connections)当前活动连接数
Current TLS Handshakes (current-tls-handshakes)当前 TLS 握手数
Current Upgraded Requests (WebSockets) (current-upgraded-requests)当前升级请求数 (WebSockets)
Failed TLS Handshakes (failed-tls-handshakes)失败的 TLS 握手总数
Request Queue Length (request-queue-length)当前请求队列的长度
TLS Handshake Rate (tls-handshakes-per-second)每秒的 TLS 握手数
Total Connections (total-connections)连接总数
Total TLS Handshakes (total-tls-handshakes) TLS 握手总数

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· Qt个人项目总结 —— MySQL数据库查询与断言
2017-02-11 面向对象设计的五大原则