gnodet opened a new pull request, #31378:
URL: https://github.com/apache/camel/pull/31378
## Summary
Fixes CAMEL-27955: Counter decrement does nothing on Prometheus counters
The `decrement` option and `CamelMetricsCounterDecrement` header of the
micrometer counter type are deprecated because Micrometer counters are
monotonic (they can only increase). Many registries, most notably Prometheus,
silently ignore negative increments by design.
## Changes
- Added deprecation warning in `CounterProducer` that logs once per producer
when decrement is used
- Deprecated the `decrement` field and its getter/setter in
`MicrometerEndpoint` with `@Deprecated(since = "4.25.0")`
- Added upgrade guide entry recommending gauges for values that can decrease
- Regenerated catalog and endpoint DSL files
## Behavior
- When a decrement is used (either via the `decrement` option or the
`CamelMetricsCounterDecrement` header), the producer now logs a warning:
```
Decrement on counter 'counter-name' is deprecated and may not work with
all registries.
Micrometer counters are monotonic and some registries (e.g., Prometheus)
silently ignore negative increments.
Consider using a gauge instead for values that can decrease.
```
- The warning is logged only once per producer instance to avoid log spam
- Existing tests continue to pass with SimpleMeterRegistry (which does
support negative increments)
## Migration Path
For users who need to track values that can both increase and decrease, the
upgrade guide recommends using:
- The gauge type of the `camel-micrometer` component, or
- The `camel-opentelemetry-metrics` component
---
_Claude Code on behalf of Guillaume Nodet_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]