-
Notifications
You must be signed in to change notification settings - Fork 205
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 Metrics #248
Add Metrics #248
Conversation
and started working on memory metrics - wip
The x-plat version is slower and its accuracy is questionable, therefore we only use it as a fallback on non-Windows OSs
Reason: WMI seem to have very bad perf.
This was already done, but now moved to a dedicated method. Also moved _timer.Start() to its own method.
Codecov Report
@@ Coverage Diff @@
## master #248 +/- ##
==========================================
+ Coverage 76.61% 79.76% +3.15%
==========================================
Files 66 68 +2
Lines 2245 2239 -6
Branches 443 403 -40
==========================================
+ Hits 1720 1786 +66
+ Misses 399 283 -116
- Partials 126 170 +44
Continue to review full report at Codecov.
|
With this approach the time range in which we measure the CPU usage is smaller than the whole time range (totalMsPassed). With this it's impossible to have higher than 100% CPU usage - this wasn't the case previously.
Failing test fixed. Decided to remove the public API part. Also, this is something most agents don’t have, so this time it wouldn't be just copying ideas :) I think it’s better to leave it out now and reiterate on this. I made everything internal, except Reason is that the Obviously sending custom metrics will be the interesting use case - and that will be implemented in a future PR. |
|
Fixed. |
@SergeyKleyman please take another look. Thanks. |
src/Elastic.Apm/Metrics/MetricsProvider/SystemTotalCpuProvider.cs
Outdated
Show resolved
Hide resolved
src/Elastic.Apm/Metrics/MetricsProvider/SystemTotalCpuProvider.cs
Outdated
Show resolved
Hide resolved
src/Elastic.Apm/Metrics/MetricsProvider/SystemTotalCpuProvider.cs
Outdated
Show resolved
Hide resolved
Tests fail on Linux, and calling |
That issue is fixed. I made the
...working on this one. |
The perf. counter API seems to return 0 for the 1. call, so we simply call it 2 times - the MetricsCollector can deal with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Failing test on Windows also fixed - the perfcounter API seems to simply return 0 for the 1. call. We had 2 calls previously there, so that's why we never noticed it. I also have some ideas why they return 0 the first time... we had the same discussion 😄 |
Awesome, I think we are good here. I'll resolve the conflict tomorrow and merge. 🚀 |
Implements #154.
system.process.cpu.total.norm.pct
system.process.memory.size
system.process.memory.rss.bytes
system.memory.actual.free
(Windows and Linux only - no macOS support atm)system.memory.total
(Windows and Linux only - no macOS support atm)system.cpu.total.norm.pct
(Windows and Linux only - we dropped the xplat implementation)Also adds public API interface to send custom metricsdecided to drop this part - current plan is to do it in a follow up PR.