Skip to content
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

Complete process metrics for CPU #911

Merged
merged 11 commits into from
Jun 10, 2024
Merged

Complete process metrics for CPU #911

merged 11 commits into from
Jun 10, 2024

Conversation

mariomac
Copy link
Contributor

@mariomac mariomac commented Jun 7, 2024

This PR provides the process.cpu.time and process.cpu.utilisation metrics according to the definition here: https://opentelemetry.io/docs/specs/semconv/system/process-metrics/

It also fixes the way the process.cpu.utilisation value was previously provided.

New metrics are expirable and their attributes are selectable. This added extra complexity:

  • If the user keeps the process.cpu.state attribute enabled, the CPU metrics need to be explicitly separated by user/system/wait time. This attribute needs to be explicitly added from the exporters, as it can't be inferred from the process.Status record.
  • If the user disables the process.cpu.state attribute, the CPU metrics need to be added into a single metric.

@mariomac mariomac marked this pull request as ready for review June 7, 2024 15:59
@mariomac mariomac requested review from grcevski and marctc as code owners June 7, 2024 15:59
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 93.95604% with 11 lines in your changes missing coverage. Please review.

Project coverage is 79.05%. Comparing base (26dc529) to head (db6ccb2).

Files Patch % Lines
pkg/internal/infraolly/process/snapshot.go 80.00% 3 Missing and 3 partials ⚠️
pkg/internal/export/otel/metrics_proc.go 93.87% 2 Missing and 1 partial ⚠️
pkg/internal/export/otel/common.go 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #911      +/-   ##
==========================================
+ Coverage   73.66%   79.05%   +5.39%     
==========================================
  Files         131      131              
  Lines        9755     9832      +77     
==========================================
+ Hits         7186     7773     +587     
+ Misses       2093     1556     -537     
- Partials      476      503      +27     
Flag Coverage Δ
integration-test 55.16% <73.07%> (+0.03%) ⬆️
k8s-integration-test 58.62% <50.00%> (?)
oats-test 35.69% <2.74%> (-0.26%) ⬇️
unittests 45.02% <91.75%> (+1.56%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Very cool!

@mariomac mariomac merged commit e94be3e into grafana:main Jun 10, 2024
6 checks passed
@mariomac mariomac deleted the proc-cpu branch June 10, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants