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

Claus Ibsen updated CAMEL-27959:
--------------------------------
    Description: 
Found while improving the option descriptions of camel-opentelemetry-metrics 
for CAMEL-23832 (commit 
https://github.com/apache/camel/commit/b03d1ed7628336a767e986b3dc2fb603a72b0b5c,
 pull request https://github.com/apache/camel/pull/31196).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. CamelMetrics* headers stay on the message when an expression fails
{{AbstractOpenTelemetryProducer.process}} evaluates metricName, 
metricsDescription and the attributes before the try/finally, so when one 
throws, clearMetricsHeaders() is skipped and the CamelMetrics* headers stay on 
the message.
Proposed change: move those evaluations inside the try.

h4. 2. A summary value that evaluates to null records nothing
{{DistributionSummaryProducer.doProcess}}: a configured value that evaluates to 
null (for example ${header.missing}) silently records nothing, while 
CounterProducer throws IllegalArgumentException in the same case.
Proposed change: throw like the counter does.

h4. 3. Smaller issues
metricType is required=true, but OpenTelemetryComponent.getMetricsType() 
defaults to counter when the path has no colon, so opentelemetry-metrics:timer 
is a counter named "timer". TimerProducer sets the unit to the lower-case 
TimeUnit name ("milliseconds") instead of the UCUM units of the OpenTelemetry 
conventions ("ms", "s"). Instruments are cached per producer by name, so 
metricsDescription and unit only apply when an instrument is first created. 
TaskTimer.stop() is never called. The pom description "Camel metrics based on 
the Camel Telemetry spec" feeds the SBOM.


_Claude Code on behalf of davsclaus_

  was:
Found while improving the option descriptions of camel-opentelemetry-metrics 
for CAMEL-23832 (pull request https://github.com/apache/camel/pull/31196).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. CamelMetrics* headers stay on the message when an expression fails
{{AbstractOpenTelemetryProducer.process}} evaluates metricName, 
metricsDescription and the attributes before the try/finally, so when one 
throws, clearMetricsHeaders() is skipped and the CamelMetrics* headers stay on 
the message.
Proposed change: move those evaluations inside the try.

h4. 2. A summary value that evaluates to null records nothing
{{DistributionSummaryProducer.doProcess}}: a configured value that evaluates to 
null (for example ${header.missing}) silently records nothing, while 
CounterProducer throws IllegalArgumentException in the same case.
Proposed change: throw like the counter does.

h4. 3. Smaller issues
metricType is required=true, but OpenTelemetryComponent.getMetricsType() 
defaults to counter when the path has no colon, so opentelemetry-metrics:timer 
is a counter named "timer". TimerProducer sets the unit to the lower-case 
TimeUnit name ("milliseconds") instead of the UCUM units of the OpenTelemetry 
conventions ("ms", "s"). Instruments are cached per producer by name, so 
metricsDescription and unit only apply when an instrument is first created. 
TaskTimer.stop() is never called. The pom description "Camel metrics based on 
the Camel Telemetry spec" feeds the SBOM.


_Claude Code on behalf of davsclaus_


> camel-opentelemetry-metrics: headers kept on an expression error, summary 
> with a null value records nothing
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27959
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27959
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-opentelemetry
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-opentelemetry-metrics 
> for CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/b03d1ed7628336a767e986b3dc2fb603a72b0b5c,
>  pull request https://github.com/apache/camel/pull/31196).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. CamelMetrics* headers stay on the message when an expression fails
> {{AbstractOpenTelemetryProducer.process}} evaluates metricName, 
> metricsDescription and the attributes before the try/finally, so when one 
> throws, clearMetricsHeaders() is skipped and the CamelMetrics* headers stay 
> on the message.
> Proposed change: move those evaluations inside the try.
> h4. 2. A summary value that evaluates to null records nothing
> {{DistributionSummaryProducer.doProcess}}: a configured value that evaluates 
> to null (for example ${header.missing}) silently records nothing, while 
> CounterProducer throws IllegalArgumentException in the same case.
> Proposed change: throw like the counter does.
> h4. 3. Smaller issues
> metricType is required=true, but OpenTelemetryComponent.getMetricsType() 
> defaults to counter when the path has no colon, so 
> opentelemetry-metrics:timer is a counter named "timer". TimerProducer sets 
> the unit to the lower-case TimeUnit name ("milliseconds") instead of the UCUM 
> units of the OpenTelemetry conventions ("ms", "s"). Instruments are cached 
> per producer by name, so metricsDescription and unit only apply when an 
> instrument is first created. TaskTimer.stop() is never called. The pom 
> description "Camel metrics based on the Camel Telemetry spec" feeds the SBOM.
> _Claude Code on behalf of davsclaus_



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

Reply via email to