fernandobalieiro commented on code in PR #23864:
URL: https://github.com/apache/camel/pull/23864#discussion_r3379161444
##########
components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifierNamingStrategy.java:
##########
@@ -73,22 +75,29 @@ default Tags getTags(ExchangeEvent event, Endpoint
endpoint) {
}
}
String routeId = event.getExchange().getFromRouteId();
- if (routeId != null) {
- return Tags.of(
- CAMEL_CONTEXT_TAG,
event.getExchange().getContext().getName(),
- KIND, KIND_EXCHANGE,
- EVENT_TYPE_TAG, event.getClass().getSimpleName(),
- ROUTE_ID_TAG, routeId,
- ENDPOINT_NAME, uri,
- FAILED_TAG,
Boolean.toString(event.getExchange().isFailed()));
- } else {
- return Tags.of(
- CAMEL_CONTEXT_TAG,
event.getExchange().getContext().getName(),
- KIND, KIND_EXCHANGE,
- EVENT_TYPE_TAG, event.getClass().getSimpleName(),
- ENDPOINT_NAME, uri,
- FAILED_TAG,
Boolean.toString(event.getExchange().isFailed()));
+ if (routeId == null) {
+ final String finalUri = uri;
+ final Optional<Route> eventRoute =
event.getExchange().getContext().getRoutes().stream()
+ .filter(route ->
finalUri.equals(route.getEndpoint().getEndpointBaseUri())).findFirst();
+
+ if (eventRoute.isEmpty()) {
+ return Tags.of(
+ CAMEL_CONTEXT_TAG,
event.getExchange().getContext().getName(),
+ KIND, KIND_EXCHANGE,
+ EVENT_TYPE_TAG, event.getClass().getSimpleName(),
+ ENDPOINT_NAME, uri,
+ FAILED_TAG,
Boolean.toString(event.getExchange().isFailed()));
+ }
+
Review Comment:
Thanks for the quick review @davsclaus!
I have created
[CAMEL-23719](https://issues.apache.org/jira/browse/CAMEL-23719), updated the
PR title and I'll submit the changes.
--
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]