[
https://issues.apache.org/jira/browse/CAMEL-26195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-26195.
---------------------------------
Resolution: Fixed
Fixed by https://github.com/apache/camel/pull/29019 (merged to main as
038fd8268a44164228035aeb95ac9f3823749d75).
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-opentelemetry-metrics - counter with increment=${body} adds 1 for a
> Map, List, POJO, File, stream or null body, and the counter header types are
> wrong in the catalog
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26195
> URL: https://issues.apache.org/jira/browse/CAMEL-26195
> Project: Camel
> Issue Type: Bug
> Components: camel-opentelemetry
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of opentelemetry-metrics
> (CAMEL-24961, PR #28414).
> h4. 1. A body that does not convert to a number silently adds 1
> {{CounterProducer.doProcess}} (main 2a465aa4814c, line 69 to 79) evaluates
> {{increment}} (and {{decrement}}) as a simple expression converted to Long;
> when the conversion gives null the code falls through to {{counter.add(1L)}}.
> With {{increment=$\{body\}}} a body "42" adds 42 and "text" fails with a
> TypeConversionException, but a Map, List, POJO, File, stream or null body
> silently adds 1. camel-micrometer {{CounterProducer}} (line 44 to 53) has the
> same fall-through (not run). Checked on 4.24.0-SNAPSHOT with an OTel
> InMemoryMetricReader as GlobalOpenTelemetry.
> Proposed: when the increment or decrement option is set but evaluates to
> null, fail (or skip) instead of adding 1.
> h4. 2. The catalog says the CamelMetricsCounterIncrement and Decrement
> headers are Double
> {{OpenTelemetryConstants}} (line 29 to 32) documents
> {{HEADER_COUNTER_DECREMENT}} and {{HEADER_COUNTER_INCREMENT}} with {{javaType
> = "Double"}}, but {{CounterProducer}} (line 71 to 72) reads them as Long.
> Read in the code, not run.
> Proposed: set {{javaType = "long"}} (as the histogram value header) and
> regenerate.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)