简体   繁体   English

ASP.NET性能计数器

[英]ASP.NET Performance Counter

I'm using the asp.net web api 2.0 and Elastic/Logstash/Kibana stack. 我正在使用asp.net Web API 2.0和Elastic / Logstash / Kibana堆栈。 Now i want to measue how long my methods need to finish. 现在我想测量我的方法需要完成多长时间。 Things i tried: 我尝试过的事情:

  • Action Filter Attribute / AOP I put an instance of Stopwatch into request.properties and measured it this way. 动作过滤器属性/ AOP我将Stopwatch的一个实例放入request.properties,并以此方式对其进行了测量。 It's positive that I can connect the method name and value and it's easy to get the results into logstash. 可以连接方法名称和值是很肯定的,而且很容易将结果转换为logstash。 But if it's possible I'm looking for a way that is more generic and maybe already implementet in asp.net. 但是,如果有可能,我正在寻找一种更通用的方法,并且可能已经在asp.net中实现了。

  • ASP.NET Performance Counter I found the Request Execution Time metrics and can check the value on perfmon. ASP.NET性能计数器我找到了“请求执行时间”度量标准,可以检查perfmon的值。 I can't connect the values to the requests, because i only get the value that belongs to the last requests, not the current (of cause, the request is still in progess). 我无法将值连接到请求,因为我仅获得属于最后一个请求的值,而不是当前的值(原因是请求仍在处理中)。 I also checked libs like Metrics.NET which also uses those counters and Logary. 我还检查了类似Metrics.NET的库,该库也使用这些计数器和Logary。 With Metrics.NET I was able to send my data to logstash, but I wasn't able to filter them so it was a mass of data. 使用Metrics.NET,我可以将数据发送到logstash,但无法过滤它们,因此它是大量数据。 With logary I configured the logstash endpoint but data didn't reach logstash. 使用logary我配置了logstash端点,但是数据没有达到logstash。

Has anyone more experience with those and can tell me which one you prefere or fits best for my needs? 有谁有更多的经验,可以告诉我您最喜欢还是最适合我的需求?

I'd recommend against using anything in code as this may add overhead to your performance. 我建议不要在代码中使用任何内容,因为这可能会增加性能开销。

.NET performance counter logs is a better solution but I'm not sure if LogStash can easily ingest these. .NET性能计数器日志是一个更好的解决方案,但我不确定LogStash是否可以轻松摄取这些日志。

I know a lot of people prefer to aggregate the raw IIS log files into LogStash. 我知道很多人喜欢将原始IIS日志文件聚合到LogStash中。 There's some guides available here: 这里有一些指南:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM