davsclaus opened a new pull request, #29223:
URL: https://github.com/apache/camel/pull/29223

   # Description
   
   JIRA: [CAMEL-26611](https://issues.apache.org/jira/browse/CAMEL-26611)
   
   The `micrometer` and `opentelemetry-metrics` producers resolved every tag 
and attribute of a meter with the Simple language, including the tags of the 
`CamelMetricsTags` header and the attributes of the `CamelMetricsAttributes` 
header. Only the `tags` and `attributes` URI options are documented as Simple 
expressions, and the `CamelMetricsName` and `CamelMetricsDescription` headers 
are already used as given. A header tag whose key or value contained `${...}` 
was therefore recorded with a different value than the one the route set, or 
failed the exchange when the text was not a valid expression.
   
   ## Change
   
   - `AbstractMicrometerProducer`: only the endpoint tags are resolved with 
Simple; the header tags are then added as they are, followed by the 
`camelContext` tag.
   - `AbstractOpenTelemetryProducer`: only the endpoint attributes are resolved 
with Simple; the header attributes are then added as they are (with the same 
String conversion of keys and values as before).
   - A tag or attribute from the header still overrides one from the URI with 
the same key.
   - The header metadata (`MicrometerConstants.HEADER_METRIC_TAGS`, 
`OpenTelemetryConstants.HEADER_METRIC_ATTRIBUTES`) and the component docs say 
that header values are used as given and point to the URI options for Simple 
expressions. Regenerated the component JSON, the catalog copies and the 
endpoint DSL.
   - Upgrade guide: an entry in the 4.24 guide. The entries for the maintenance 
lines go to the 4.22 and 4.18 guides on `main` with the backports.
   
   ## Tests
   
   - camel-micrometer `CounterRouteTest`: `testHeaderTagsAreUsedAsGiven` (a 
header tag value `${body}` and a header tag key `${header.k}` are recorded as 
given, while the URI tag `tags.a=${body.length}` is still resolved), 
`testHeaderTagOverridesUriTagWithSameKey`.
   - camel-opentelemetry-metrics `CounterRouteTest`: 
`testHeaderAttributesAreUsedAsGiven`, 
`testHeaderAttributeOverridesUriAttributeWithSameKey`.
   - `testHeaderTagsAreUsedAsGiven` and `testHeaderAttributesAreUsedAsGiven` 
fail without the producer change (`expected: <${body}> but was: <Hello>`).
   - `mvn install` of both modules: camel-micrometer 119 tests, 
camel-opentelemetry-metrics 96 + 5 tests, all passing.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 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]

Reply via email to