opentelemetry-go-contrib
opentelemetry-go-contrib copied to clipboard
Implement new runtime metrics
Part of https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5655
Changes:
- Move the configuration options to
options.gowithout modification. - Implements the metrics defined here: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/runtime/go-metrics.md. These are still disabled by default while it is under development.
- Add unit tests
Notes:
It doesn't implement go.schedule.duration, as the histogram will need some additional work to figure out.
Based on https://github.com/prometheus/client_golang/pull/955#issue-1090830520, using go's runtime metrics should is more efficient than reading memstats.
Codecov Report
Attention: Patch coverage is 85.24590% with 18 lines in your changes missing coverage. Please review.
Project coverage is 65.2%. Comparing base (
879727b) to head (79f0b56).
Additional details and impacted files
@@ Coverage Diff @@
## main #5780 +/- ##
=======================================
+ Coverage 64.9% 65.2% +0.3%
=======================================
Files 202 203 +1
Lines 12654 12759 +105
=======================================
+ Hits 8213 8326 +113
+ Misses 4210 4190 -20
- Partials 231 243 +12
| Files | Coverage Δ | |
|---|---|---|
| instrumentation/runtime/options.go | 100.0% <100.0%> (ø) |
|
| instrumentation/runtime/runtime.go | 79.6% <82.8%> (+79.6%) |
:arrow_up: |
Waiting to merge so @XSAM can review.
Working on tests. metrics.Read is being strange during unit testing, and seems to always return the same result.
I had to add code that allocates memory to ensure the metric actually changes for the refresh test. I ran it locally with -count 10000, and it passes, so hopefully it won't be flaky.
/gc/heap/allocs:bytes and /gc/heap/allocs:objects don't seem to be populated on windows. I'm investigating
I think I got the test passing
Looks like go mod tidy needs to be run.
@XSAM PTAL.
@XSAM planning to merge this in an hour or two unless I hear from you otherwise.