Interface ObservationCollector<T>


  • public interface ObservationCollector<T>
    API to instrument operations in the stream client. The supported operations are publishing, and asynchronous delivery.

    Implementations can gather information and send it to tracing backends. This allows e.g. following the processing steps of a given message through different systems.

    This is considered an SPI and is susceptible to change at any time.

    Since:
    0.12.0
    See Also:
    EnvironmentBuilder.observationCollector(ObservationCollector), MicrometerObservationCollectorBuilder
    • Method Detail

      • prePublish

        T prePublish​(String stream,
                     Message message)
        Start observation.

        Implementations are expecting to return an observation context that will be passed in to the published(Object, Message) callback.

        Parameters:
        stream - the stream to publish to
        message - the message to publish
        Returns:
        observation context
      • published

        void published​(T context,
                       Message message)
        Callback when the message is about to be published.
        Parameters:
        context - the observation context
        message - the message to publish
      • subscribe

        MessageHandler subscribe​(MessageHandler handler)
        Decorate consumer registration.
        Parameters:
        handler - the original handler
        Returns:
        a decorated handler
      • isNoop

        default boolean isNoop()
        Says whether the implementation does nothing or not.
        Returns:
        true if the implementation is a no-op