Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15457

camel-micrometer: NullPointer exception triggered by MicrometerExchangeEventNotifier

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.5.0
    • Component/s: camel-micrometer
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      A recent [comit|https://github.com/apache/camel/pull/3976] causes NullPointer exceptions in some circumstances, though they are caught and logged as "WARN".

      Output from the test testCamelRouteEvents() in MicrometerExchangeEventNotifierTest in master branch:

      11:44:32.741 [main] WARN org.apache.camel.support.EventHelper - Error notifying event ID-devbox-1598261669122-0-1 exchange Exchange[ID-devbox-1598261669122-0-1] sending to: direct://in. This exception will be ignored.11:44:32.741 [main] WARN org.apache.camel.support.EventHelper - Error notifying event ID-devbox-1598261669122-0-1 exchange Exchange[ID-devbox-1598261669122-0-1] sending to: direct://in. This exception will be ignored.java.lang.NullPointerException: null at java.util.Objects.requireNonNull(Objects.java:221) ~[?:?] at io.micrometer.core.instrument.ImmutableTag.<init>(ImmutableTag.java:35) ~[micrometer-core-1.5.4.jar:1.5.4] at io.micrometer.core.instrument.Tag.of(Tag.java:29) ~[micrometer-core-1.5.4.jar:1.5.4] at io.micrometer.core.instrument.Tags.of(Tags.java:254) ~[micrometer-core-1.5.4.jar:1.5.4] at org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategy.getInflightExchangesTags(MicrometerExchangeEventNotifierNamingStrategy.java:58) ~[classes/:?] at org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier.handleExchangeEvent(MicrometerExchangeEventNotifier.java:80) ~[classes/:?] at org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier.notify(MicrometerExchangeEventNotifier.java:65) ~[classes/:?] at org.apache.camel.support.EventHelper.doNotifyEvent(EventHelper.java:1236) ~[classes/:?] at org.apache.camel.support.EventHelper.notifyExchangeSending(EventHelper.java:700) ~[classes/:?]
      

      The problem is that the MicrometerExchangeEventNotifier tries to build/update a metric on inflight exchanges in a route based on an ExchangeEvent with no associated fromRoute/fromRouteId. Events such as "ExchangeSendingEvent", as is created in the test, is an example of such an ExchangeEvent.

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                eandre Espen Andreassen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: