Change process.uptime from TimeGauge to FunctionCounter#7458
Conversation
The process.uptime metric semantically represents a monotonically increasing accumulated value, making FunctionCounter a more appropriate choice than TimeGauge. This aligns with the discussion in PR micrometer-metrics#7297. Fixes micrometer-metrics#7346 Signed-off-by: Sehz <sehz@openclaw.local>
baa4133 to
b66e7ae
Compare
|
Thank you for the PR! If this PR was (at least partly) created by some kind of AI tooling, could you please tell us what tool/tools you used so that we can keep the records of it? I think this should wait for #7329 but also, as the original issue mentioned (#7346) as well as the description of this PR: this is a breaking change and I think we should not do this as-is. At least we should introduce some kind of an opt-in mechanism with probably deprecating the old one: #7311 |
|
Thank you for the review! Yeah, this PR was created with assistance from an AI tool (OpenClaw). I'll note that going forward. Agreed on waiting for #7329 and the opt-in mechanism. The semantic correctness of FunctionCounter for a monotonically increasing value is clear, but you're right that a breaking change deserves a proper deprecation path rather than a silent swap. I'll leave this PR open as a reference and happy to implement the opt-in approach if #7311 moves forward. |
Summary
Changed
process.uptimemeter fromTimeGaugetoFunctionCounterinUptimeMetrics. Semantically,process.uptimeis a monotonically increasing accumulated value, makingFunctionCounterthe more appropriate meter type — matching the discussion in PR #7297.What changed
UptimeMetrics.java
TimeGaugetoFunctionCounter.baseUnit("ms")for consistency with the native unit returned byRuntimeMXBean::getUptimeUptimeMetricsTest.java
.timeGauge()to.functionCounter()1.337(converted to seconds) to1337.0(raw milliseconds from mock)Breaking change note
For registries that treat gauges and counters differently, this is a breaking change for
process.uptime. Users monitoring this metric may need to update their dashboards or alerting rules. The issue #7346 notes this was a consideration and it may be appropriate to wait for 2.0 for this change, but the semantic correctness makes it worth proposing now.Fixes
Fixes #7346