Skip to content

fix: preserve semantic version in node metric - #403

Open
Cryptoloveer wants to merge 2 commits into
attocash:mainfrom
Cryptoloveer:fix/node-version-metric
Open

fix: preserve semantic version in node metric#403
Cryptoloveer wants to merge 2 commits into
attocash:mainfrom
Cryptoloveer:fix/node-version-metric

Conversation

@Cryptoloveer

Copy link
Copy Markdown

Problem

NodeMetricProvider converts the application version to a Double before registering the metric. That works for two-part values such as 2.1, but semantic versions such as 7.0.2 cannot be represented as a Double; toDoubleOrNull() therefore falls back to 0.0. The exported version tag consequently loses the actual release version.

Fix

Treat node.version as an information-style gauge:

  • keep its numeric sample at the conventional constant value 1;
  • preserve the normalized application version as the version tag;
  • continue removing a pre-release suffix such as -SNAPSHOT, matching the existing behavior.

Validation

Added focused tests covering:

  • a three-part semantic version with a -SNAPSHOT suffix;
  • the local development fallback value;
  • the gauge's constant information value.

The change is limited to node-version metric registration and its tests.

@Cryptoloveer
Cryptoloveer requested a review from a team as a code owner September 12, 2026 14:22
@rotilho

rotilho commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR!

Atto node releases use a two-component version format (e.g. 1.35), so the semantic-version case addressed here does not affect the node.

This change would also make the node.version gauge value always 1.0, moving the actual version entirely to the tag, which changes the current semantics of the metric.

There is, however, a known issue when the node version ends in 0, for example 1.30, which is currently exposed as 1.3. This is a limitation of representing the version as a numeric Micrometer gauge, since the value is stored as a Double and therefore cannot preserve trailing zeros.

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.

2 participants