Class OpenTelemetryEventPublisherBeansApplicationListener

java.lang.Object
org.springframework.boot.actuate.autoconfigure.tracing.OpenTelemetryEventPublisherBeansApplicationListener
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, org.springframework.context.event.GenericApplicationListener, org.springframework.context.event.SmartApplicationListener, org.springframework.core.Ordered

public class OpenTelemetryEventPublisherBeansApplicationListener extends Object implements org.springframework.context.event.GenericApplicationListener
ApplicationListener to add an OpenTelemetry ContextStorage wrapper for OtelTracer.EventPublisher bean support. A single ContextStorage wrapper is added on the ApplicationStartingEvent then updated with OtelTracer.EventPublisher beans as needed.

The addWrapper() method may also be called directly if the ApplicationStartingEvent isn't called early enough or isn't fired.

Since:
3.4.0
See Also:
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Add the ContextStorage wrapper to ensure that EventPublishers are propagated correctly.
    int
     
    void
    onApplicationEvent(org.springframework.context.ApplicationEvent event)
     
    boolean
    supportsEventType(org.springframework.core.ResolvableType eventType)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution

    Methods inherited from interface org.springframework.context.event.GenericApplicationListener

    supportsEventType

    Methods inherited from interface org.springframework.context.event.SmartApplicationListener

    getListenerId, supportsSourceType
  • Constructor Details

    • OpenTelemetryEventPublisherBeansApplicationListener

      public OpenTelemetryEventPublisherBeansApplicationListener()
  • Method Details

    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Specified by:
      getOrder in interface org.springframework.context.event.SmartApplicationListener
    • supportsEventType

      public boolean supportsEventType(org.springframework.core.ResolvableType eventType)
      Specified by:
      supportsEventType in interface org.springframework.context.event.GenericApplicationListener
    • onApplicationEvent

      public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
    • addWrapper

      public static void addWrapper()
      Add the ContextStorage wrapper to ensure that EventPublishers are propagated correctly.