New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GC time to the .Net Agent #922
Comments
Hi @jpenniman sounds reasonable. The set of metrics the agent currently collects is definitely not final, we plan to extend it and iterate on it. I'd be happy to help and review this if you open a PR. The name And also the 2 proposed solutions are ok. You probably already found this file where you can implement it. Before you open a PR please quickly go through our CONTRIBUTING.md. |
Ok great. I'll go through the doc and sign the agreement. |
* Implements #922: Add GC time to the .Net Agent * Represent GC Time as a sum for the sample period. * GC time: add test to assert on metric with `clr.gc.time` * Update GcMetricsProvider.cs GC time calculation on Full Framework: calculate GC time based on times span between Start and Stop Co-authored-by: Greg Kalapos <gergo@kalapos.net>
This was implemented in #925. |
The .Net Agent already records the number collections and the heap sizes, however it is missing the pause time.
Recording GC pause times is critical for identifying memory leaks. When troubleshooting high memory utilization, we want to answer: "Is CPU high too?" and "How much of that CPU time is being used by the garbage collector?" If the garbage collector is running a lot, but collecting very little, it's an indication that there is likely a memory leak. Long GC pause times can also cause application performance issues even without a memory leak. Understanding pause times is key to understanding if application slowness is possibly do to long pause times or too frequent pauses.
The Java agent records:
jvm.gc.time
I'm proposing a .net equivalent:
clr.gc.time
For full framework:
.Net Core doens't write pause time data o the event, but it can be calculated by capturing the instant of GCStart and doing the math in GCEnd. It's not perfect, since not all collections stop the world. Labeling the metric with the generation being collected and GC settings can help the engineer determine if the gc.time is a pause or not.
Our application currently uses similar code to get the GC Pause time. We've tested code in net461, net472, and netcoreapp3.1 on both Windows and Linux, and it successfully reports GC pause times in all targets. Ideally, we'd like to get this functionality into the Agent, so it's something we don't have to maintain separately.
I'm available to add this feature one we can agree on implementation approach.
The text was updated successfully, but these errors were encountered: