Skip to content

feat: add node_readiness_build_info metric - #406

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
rawadhossain:build-info
Aug 14, 2026
Merged

feat: add node_readiness_build_info metric#406
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
rawadhossain:build-info

Conversation

@rawadhossain

Copy link
Copy Markdown
Contributor

Description

Adds node_readiness_build_info metric from observability design doc

Changes

  • Add node_readiness_build_info gauge with a version label.
  • Set the metric at controller startup using the build version.
  • Wire build version and git commit metadata through -ldflags in the Makefile and Dockerfile.

Implementation choices

  • Use the build version as the version label, while keeping commit information in the existing startup version log.
  • Added -ldflags wiring because the existing internal/info version variables were not being populated during builds, which otherwise left the version as unknown.

Related to Issue #182

Type of Change

/kind feature

Verification

  • Verified the metric reports the actual git-derived version from a locally built binary.
  • Verified the same version is propagated through the Docker build path.

Checklist

  • make test passes
  • make lint passes

@kubernetes-prow kubernetes-prow Bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 13, 2026
@netlify

netlify Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploy Preview for node-readiness-controller canceled.

Name Link
🔨 Latest commit 8665be6
🔍 Latest deploy log https://app.netlify.com/projects/node-readiness-controller/deploys/6a7f42588167ec0008ae2894

@kubernetes-prow
kubernetes-prow Bot requested a review from dchen1107 August 13, 2026 16:59
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 13, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from tallclair August 13, 2026 16:59
@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 13, 2026
@kubernetes-prow

Copy link
Copy Markdown

Hi @rawadhossain. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 13, 2026
Comment thread internal/metrics/metrics.go Outdated
Name: "node_readiness_build_info",
Help: "Build information for the node-readiness-controller binary.",
},
[]string{"version"},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pls add a git_commit label here []string{"version", "git_commit"}

Prometheus standards require the commit hash on build metrics

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I kept the metric scoped to the binary version since the commit is already exposed in the startup log.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like there's an idiomatic way to report this: prometheus/client_golang#693

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out, the example helped. Updated it.

@ajaysundark ajaysundark Aug 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The other identifying labels from prometheus example (eg: revision / goversion) are useful and could be extended as labels here, but I'm not blocking this CL on this, you could followup on this after -
https://github.com/prometheus/common/blob/2fb5a7cecbffd4bf7dc88ff22712112e8cef8432/version/info.go#L42

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I’ll do follow-up on this if needed to extend going ahead.

Comment thread cmd/main.go Outdated
Comment thread Makefile
Comment thread internal/metrics/metrics.go Outdated
Name: "node_readiness_build_info",
Help: "Build information for the node-readiness-controller binary.",
},
[]string{"version"},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like there's an idiomatic way to report this: prometheus/client_golang#693

Comment thread internal/metrics/metrics.go
@ajaysundark

Copy link
Copy Markdown
Contributor

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 14, 2026
@kubernetes-prow kubernetes-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 14, 2026
@rawadhossain

Copy link
Copy Markdown
Contributor Author

@ajaysundark added the tests. Should be good to merge.

Signed-off-by: Rawad Hossain <rawad.hossain00@gmail.com>
@ajaysundark

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 14, 2026
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ajaysundark, rawadhossain

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 14, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Aug 14, 2026
@kubernetes-prow kubernetes-prow Bot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 14, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit f23f26c into kubernetes-sigs:main Aug 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants