This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 9b1bc19bc08 fix(observation): create a generic log event 9b1bc19bc08 is described below commit 9b1bc19bc08772927b1005f4a8da0731bde00b08 Author: Pasquale Congiusti <pasquale.congiu...@gmail.com> AuthorDate: Thu Mar 13 11:25:46 2025 +0100 fix(observation): create a generic log event Instead of a log event for each different log message. Closes CAMEL-21854 --- .../observation/MicrometerObservationSpanAdapter.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/components/camel-observation/src/main/java/org/apache/camel/observation/MicrometerObservationSpanAdapter.java b/components/camel-observation/src/main/java/org/apache/camel/observation/MicrometerObservationSpanAdapter.java index d500cff8093..84e93392b55 100644 --- a/components/camel-observation/src/main/java/org/apache/camel/observation/MicrometerObservationSpanAdapter.java +++ b/components/camel-observation/src/main/java/org/apache/camel/observation/MicrometerObservationSpanAdapter.java @@ -108,13 +108,9 @@ public class MicrometerObservationSpanAdapter implements SpanAdapter { public void log(Map<String, String> fields) { String event = fields.get("event"); if ("error".equalsIgnoreCase(event)) { - if (fields.containsKey("message")) { - observation.error(new RuntimeException(fields.get("message"))); - } else { - setError(true); - } + setError(true); } else { - observation.event(() -> getMessageNameFromFields(fields)); + observation.event(() -> DEFAULT_EVENT_NAME); } } @@ -139,14 +135,6 @@ public class MicrometerObservationSpanAdapter implements SpanAdapter { return observation.openScope(); } - String getMessageNameFromFields(Map<String, ?> fields) { - Object eventValue = fields == null ? null : fields.get("message"); - if (eventValue != null) { - return eventValue.toString(); - } - return DEFAULT_EVENT_NAME; - } - public void setCorrelationContextItem(String key, String value) { Baggage baggage = tracer.createBaggage(key); Span span = getTracingContext().getSpan();