[ 
https://issues.apache.org/jira/browse/CAMEL-27633?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27633:
--------------------------------
    Fix Version/s: 4.25.0
                       (was: 4.24.0)

> camel-metrics: decrement header ignored, wrong exception doc, metricsType 
> required
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-27633
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27633
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-metrics
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-metrics for 
> CAMEL-23832 (PR https://github.com/apache/camel/pull/30970).
> These are separate problems of the component; the descriptions PR only 
> documents the current behavior.
> h4. 1. The CamelMetricsCounterDecrement header is ignored when the endpoint 
> sets increment
> {{CounterProducer.doProcess()}} reads the increment as {{getLongHeader(in, 
> HEADER_COUNTER_INCREMENT, endpoint.getIncrement())}} and calls 
> {{counter.inc()}} whenever that value is not null.
> So on {{metrics:counter:name?increment=7}} a {{CamelMetricsCounterDecrement}} 
> header has no effect: the counter is still incremented by 7.
> The doc page says that the headers override the increment and decrement 
> values of the URI, and the user expects the counter to go down.
> Proposed change: let a counter header win over both endpoint options, for 
> example by checking the two headers first and only then the two options.
> h4. 2. The doc page says that exceptions are caught and logged at WARN
> The Headers section of {{metrics-component.adoc}} says that the endpoint 
> catches all exceptions and writes a log entry at level {{warn}}.
> {{AbstractMetricsProducer.process()}} does not log: it sets the exception on 
> the exchange with {{exchange.setException(e)}}, so the error handler of the 
> route handles it.
> Proposed change: correct the doc page to describe the current behavior.
> h4. 3. The metricsType path parameter is marked required but is optional
> {{MetricsEndpoint.metricsType}} has {{@Metadata(required = true)}}, so the 
> catalog and the tooling show it as required.
> {{MetricsComponent.getMetricsType()}} uses {{DEFAULT_METRICS_TYPE}} (meter) 
> when the URI has no type, as in {{metrics:myName}}, and the doc page says so 
> too.
> Proposed change: drop {{required = true}} from {{metricsType}} and give it 
> {{defaultValue = "meter"}}.
> _Claude Code on behalf of davsclaus_



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

Reply via email to