Skip to content

811: Add SHA as a metric - #804

Merged
tahminator merged 1 commit into
mainfrom
811
Feb 21, 2026
Merged

811: Add SHA as a metric#804
tahminator merged 1 commit into
mainfrom
811

Conversation

@tahminator

@tahminator tahminator commented Feb 21, 2026

Copy link
Copy Markdown
Member

811

Description of changes

Checklist before review

  • I have done a thorough self-review of the PR
  • Copilot has reviewed my latest changes, and all comments have been fixed and/or closed.
  • If I have made database changes, I have made sure I followed all the db repo rules listed in the wiki here. (check if no db changes)
  • All tests have passed
  • I have successfully deployed this PR to staging
  • I have done manual QA in both dev (and staging if possible) and attached screenshots below.

Screenshots

image

@tahminator

Copy link
Copy Markdown
Member Author

/deploy

@github-actions

Copy link
Copy Markdown
Contributor

Available PR Commands

  • /ai - Triggers all AI review commands at once
  • /review - AI review of the PR changes
  • /describe - AI-powered description of the PR
  • /improve - AI-powered suggestions
  • /deploy - Deploy to staging

See: https://github.com/tahminator/codebloom/wiki/CI-Commands

@github-actions

Copy link
Copy Markdown
Contributor

Title

811: Add SHA as a metric


PR Type

Enhancement


Description

  • Add application.info gauge tagged with SHA

  • Enable CommitShaProperties configuration binding

  • Import Micrometer Tag and Tags


Diagram Walkthrough

flowchart LR
  props["CommitShaProperties (sha)"]
  binder["MeterBinder: applicationInfoMetrics"]
  registry["Micrometer Registry"]
  gauge["Gauge: application.info (tag: sha)"]

  props -- "provides sha" --> binder
  binder -- "registers gauge" --> registry
  registry -- "exposes" --> gauge
Loading

File Walkthrough

Relevant files
Enhancement
SystemMetricsConfig.java
Expose commit SHA via Micrometer application gauge             

src/main/java/org/patinanetwork/codebloom/utilities/SystemMetricsConfig.java

  • Enable @EnableConfigurationProperties for CommitShaProperties.
  • Add applicationInfoMetrics MeterBinder bean.
  • Register application.info gauge with sha tag.
  • Import Micrometer Tag and Tags.
+13/-0   

@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Null/blank SHA handling

Creating a tag from a possibly null or blank value can throw and break metrics initialization. Provide a safe default (e.g., 'unknown') and/or validate/sanitize the SHA before building tags.

public MeterBinder applicationInfoMetrics(CommitShaProperties commitShaProperties) {
    return registry -> {
        var tags = Tags.of(Tag.of("sha", commitShaProperties.getSha()));
        registry.gauge("application.info", tags, 1, n -> 1.0);
    };
Gauge registration

Using registry.gauge with a boxed constant as the state object risks GC and NaN readings. Prefer Gauge.builder("application.info", () -> 1.0).tags(tags).register(registry) to avoid weak-reference pitfalls.

registry.gauge("application.info", tags, 1, n -> 1.0);
Metric naming/cardinality

The 'sha' tag may introduce high cardinality over deployments and the metric name might not align with existing conventions. Confirm naming with observability standards and consider a more specific tag key (e.g., 'commit_sha') and/or metric description.

return registry -> {
    var tags = Tags.of(Tag.of("sha", commitShaProperties.getSha()));
    registry.gauge("application.info", tags, 1, n -> 1.0);

@tahminator
tahminator merged commit 93fb0ae into main Feb 21, 2026
31 checks passed
@tahminator
tahminator deleted the 811 branch February 21, 2026 09:05
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.

1 participant