Skip to content

Add all Go runtime metrics #997

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dongjiang1989
Copy link

expose all Go runtime metrics like GC stats, memory stats etc.

Signed-off-by: dongjiang <dongjiang1989@126.com>
@oliver006
Copy link
Owner

Thanks for the PR!

Looking at the docs (and at the metrics that the exporter currently exports), I think thee two are already included in the default registry:

From:
https://github.com/prometheus/client_golang/blob/96a5ad6ef56e0d41d3bf06ba0478b34a0c718a92/prometheus/doc.go#L185-L188

// Also note that the DefaultRegisterer comes registered with a Collector for Go
// runtime metrics (via NewGoCollector) and a Collector for process metrics (via
// NewProcessCollector). With a custom registry, you are in control and decide
// yourself about the Collectors to register.

Copy link

codecov bot commented Apr 26, 2025

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 80.68%. Comparing base (145ab23) to head (56a7cb7).

Files with missing lines Patch % Lines
main.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #997      +/-   ##
==========================================
- Coverage   80.82%   80.68%   -0.14%     
==========================================
  Files          19       19              
  Lines        2951     2956       +5     
==========================================
  Hits         2385     2385              
- Misses        456      461       +5     
  Partials      110      110              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14639048560

Details

  • 0 of 6 (0.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 84.452%

Changes Missing Coverage Covered Lines Changed/Added Lines %
main.go 0 6 0.0%
Files with Coverage Reduction New Missed Lines %
main.go 1 0.0%
Totals Coverage Status
Change from base Build 14555681531: -0.1%
Covered Lines: 2504
Relevant Lines: 2965

💛 - Coveralls

@dongjiang1989
Copy link
Author

dongjiang1989 commented Apr 27, 2025

Looking at the docs (and at the metrics that the exporter currently exports), I think thee two are already included in the default registry:

Thanks @oliver006 review

Differences:

MustRegister(NewGoCollector())

change to

MustRegister(collectors.NewGoCollector(collectors.WithGoCollectorRuntimeMetrics(collectors.MetricsAll)))

ref: https://github.com/prometheus/client_golang/blob/main/prometheus/registry.go#L60-L63

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.

3 participants