gnodet opened a new pull request, #21201: URL: https://github.com/apache/camel/pull/21201
## Description This PR fixes CAMEL-22938 - a Map type mismatch issue in `OpenTelemetrySpanAdapter` that was reported by SonarCloud. ## Problem The deprecated `setTag(Tag key, ...)` methods were passing `Tag` enum objects directly to `TAG_MAP.getOrDefault()` instead of calling `key.getAttribute()` first. Since `TAG_MAP` is declared as `Map<String, String>` and keyed by String values, the lookup would always fail and return the default value. ## Solution Changed lines 78 and 88 to call `key.getAttribute()` before the Map lookup: - Line 78: `TAG_MAP.getOrDefault(key, ...)` → `TAG_MAP.getOrDefault(key.getAttribute(), ...)` - Line 88: `TAG_MAP.getOrDefault(key, ...)` → `TAG_MAP.getOrDefault(key.getAttribute(), ...)` This ensures the Tag enum is converted to its String representation before the Map lookup, allowing proper mapping of tags to OpenTelemetry semantic attributes. ## Testing - ✅ Build successful: `mvn clean compile -pl components/camel-opentelemetry -am -Dquickly` - ✅ All tests pass: `mvn test -pl components/camel-opentelemetry` (23 tests, 0 failures) ## Impact - Fixes the SonarCloud issue about Map with wrong type for key - Ensures proper mapping of deprecated Tag enum values to OpenTelemetry semantic attributes - Minimal change with no impact on non-deprecated methods - Since these methods are already deprecated, impact is limited to legacy code ## Related Issue https://issues.apache.org/jira/browse/CAMEL-22938 --- Pull Request opened by [Augment Code](https://www.augmentcode.com/) with guidance from the PR author -- 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]
