Claus Ibsen created CAMEL-26510:
-----------------------------------

             Summary: camel-micrometer - counter adds 1 when the increment or 
decrement option gives no number
                 Key: CAMEL-26510
                 URL: https://issues.apache.org/jira/browse/CAMEL-26510
             Project: Camel
          Issue Type: Bug
          Components: camel-micrometer
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The counter producer of camel-micrometer adds 1 when the {{increment}} or 
{{decrement}} option is set but gives no number.

{{CounterProducer.doProcess}} evaluates both options (and the 
{{CamelMetricsCounterIncrement}} / {{CamelMetricsCounterDecrement}} headers). 
When both end up null, for example {{increment=$\{header.inc\}}} and the header 
is missing, it falls through to {{counter.increment()}} and counts 1 for 
something that did not happen.

camel-opentelemetry-metrics had the same bug (CAMEL-26195). Same fix here: when 
increment or decrement is configured but neither the options nor the headers 
give a number, fail the exchange and leave the counter unchanged. With neither 
option set, the counter still increments by 1 as documented. Upgrade-guide 
entry, since a route relying on the add-1 now fails.

_Claude Code on behalf of Claus Ibsen (davsclaus)_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to