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

feat: Add build_info metric with version, sha, goversion labels #5213

Merged
merged 5 commits into from
Dec 7, 2023

Conversation

nantiferov
Copy link
Contributor

@nantiferov nantiferov commented Dec 3, 2023

Fixes kubernetes-sigs/karpenter#665

Description

As described in the issue, it's useful to have metric with at least version label, which makes easier to find what version was running at each time to correlate issues related to update, etc. Example https://www.robustperception.io/exposing-the-software-version-to-prometheus/

So far this implementation might be a little bit "naive", since I tried to adopt existing code in project to add one more metric. If this should be done in a different way, I'm glad to have a feedback.

Also, I added only version and golang_version labels, because they're already available. In theory more can be added, like branch or sha. Not sure if they're very useful though.

I checked contribution guide and tried to follow it.

How was this change tested?

Did make apply with pushing image to temporary ECR registry and deploying karpenter to my test EKS cluster.
All works fine, example of metric output:

# HELP karpenter_build_info A metric with a constant '1' value labeled by version from which karpenter was built.
# TYPE karpenter_build_info gauge
karpenter_build_info{golang_version="go1.21.4",sha="e19bcd7-dirty",version="e19bcd70"} 1

Does this change impact docs?

  • Yes, PR includes docs updates
  • Yes, issue opened: #
  • No

Not sure, probably need to update docs, but closer to PR be ready to merge.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

netlify bot commented Dec 3, 2023

Deploy Preview for karpenter-docs-prod canceled.

Name Link
🔨 Latest commit 340635a
🔍 Latest deploy log https://app.netlify.com/sites/karpenter-docs-prod/deploys/6572145f95ddc700083d54ae

pkg/operator/operator.go Outdated Show resolved Hide resolved
pkg/operator/operator.go Outdated Show resolved Hide resolved
@nantiferov nantiferov marked this pull request as ready for review December 6, 2023 18:10
@nantiferov nantiferov requested a review from a team as a code owner December 6, 2023 18:10
@nantiferov
Copy link
Contributor Author

I think PR is ready for review, please check it.

Also, let me know if docs should be updated. Quick check shows that I can open PR to update metrics page https://github.com/aws/karpenter-provider-aws/blob/main/website/content/en/docs/reference/metrics.md

@coveralls
Copy link

coveralls commented Dec 7, 2023

Pull Request Test Coverage Report for Build 7132706642

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 82.495%

Totals Coverage Status
Change from base Build 7110677239: 0.006%
Covered Lines: 4920
Relevant Lines: 5964

💛 - Coveralls

@nantiferov nantiferov changed the title feat: Add build_info metric with version label feat: Add build_info metric with version, sha, golang_version labels Dec 7, 2023
Co-authored-by: Jonathan Innis <jonathan.innis.ji@gmail.com>
Copy link
Contributor

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@jonathan-innis jonathan-innis enabled auto-merge (squash) December 7, 2023 19:26
@jonathan-innis jonathan-innis merged commit 1e4e84d into aws:main Dec 7, 2023
12 checks passed
@nantiferov nantiferov changed the title feat: Add build_info metric with version, sha, golang_version labels feat: Add build_info metric with version, sha, goversion labels Dec 8, 2023
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.

Proposal: Add metric with Karpenter version
3 participants