Class MatsMicrometerInterceptor

  • All Implemented Interfaces:
    io.mats3.api.intercept.MatsInitiateInterceptor, io.mats3.api.intercept.MatsMetricsInterceptor, io.mats3.api.intercept.MatsStageInterceptor

    public class MatsMicrometerInterceptor
    extends java.lang.Object
    implements io.mats3.api.intercept.MatsMetricsInterceptor, io.mats3.api.intercept.MatsInitiateInterceptor, io.mats3.api.intercept.MatsStageInterceptor
    An interceptor that instruments a MatsFactory with metrics using the (Spring) Micrometer framework. If you provide a MeterRegistry, it will employ this to create the metrics on, otherwise it employs the Metrics.globalRegistry.

    Note: This interceptor (Micrometer Metrics) has special support in JmsMatsFactory: If present on the classpath, it is automatically installed using the install(MatsInterceptable) install method. This implies that it employs the Micrometer 'globalRegistry'. If you rather want to supply a specific registry, then install a different instance using the install(MatsInterceptable, MeterRegistry) method - the JmsMatsFactory will then remove the automatically installed, since it implements the special marker-interface MatsMetricsInterceptor of which there can only be one instance installed.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.mats3.api.intercept.MatsInitiateInterceptor

        io.mats3.api.intercept.MatsInitiateInterceptor.InitiateCompletedContext, io.mats3.api.intercept.MatsInitiateInterceptor.InitiateInterceptContext, io.mats3.api.intercept.MatsInitiateInterceptor.InitiateInterceptOutgoingMessagesContext, io.mats3.api.intercept.MatsInitiateInterceptor.InitiateInterceptUserLambdaContext, io.mats3.api.intercept.MatsInitiateInterceptor.InitiateStartedContext, io.mats3.api.intercept.MatsInitiateInterceptor.MatsInitiateInterceptOutgoingMessages, io.mats3.api.intercept.MatsInitiateInterceptor.MatsInitiateInterceptUserLambda
      • Nested classes/interfaces inherited from interface io.mats3.api.intercept.MatsStageInterceptor

        io.mats3.api.intercept.MatsStageInterceptor.MatsStageInterceptOutgoingMessages, io.mats3.api.intercept.MatsStageInterceptor.MatsStageInterceptUserLambda, io.mats3.api.intercept.MatsStageInterceptor.StageCommonContext, io.mats3.api.intercept.MatsStageInterceptor.StageCompletedContext, io.mats3.api.intercept.MatsStageInterceptor.StageInterceptContext, io.mats3.api.intercept.MatsStageInterceptor.StageInterceptOutgoingMessageContext, io.mats3.api.intercept.MatsStageInterceptor.StageInterceptUserLambdaContext, io.mats3.api.intercept.MatsStageInterceptor.StagePreprocessAndDeserializeErrorContext, io.mats3.api.intercept.MatsStageInterceptor.StageReceivedContext
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String LOG_PREFIX  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void initiateCompleted​(io.mats3.api.intercept.MatsInitiateInterceptor.InitiateCompletedContext ctx)  
      static MatsMicrometerInterceptor install​(io.mats3.api.intercept.MatsInterceptable matsInterceptable)
      Installs a singleton instance of MatsMicrometerInterceptor which employs the Metrics.globalRegistry, on the provided MatsInterceptable (which most probably is a MatsFactory).
      static MatsMicrometerInterceptor install​(io.mats3.api.intercept.MatsInterceptable matsInterceptableMatsFactory, io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Creates a MatsMicrometerInterceptor employing the provided MeterRegistry, and installs it as a singleton on the provided MatsInterceptable (which most probably is a MatsFactory).
      void stageCompleted​(io.mats3.api.intercept.MatsStageInterceptor.StageCompletedContext ctx)  
      void stageReceived​(io.mats3.api.intercept.MatsStageInterceptor.StageReceivedContext ctx)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.mats3.api.intercept.MatsInitiateInterceptor

        initiateStarted
      • Methods inherited from interface io.mats3.api.intercept.MatsStageInterceptor

        stagePreprocessAndDeserializeError
    • Method Detail

      • install

        public static MatsMicrometerInterceptor install​(io.mats3.api.intercept.MatsInterceptable matsInterceptableMatsFactory,
                                                        io.micrometer.core.instrument.MeterRegistry meterRegistry)
        Creates a MatsMicrometerInterceptor employing the provided MeterRegistry, and installs it as a singleton on the provided MatsInterceptable (which most probably is a MatsFactory).
        Parameters:
        matsInterceptableMatsFactory - the MatsInterceptable to install on (probably a MatsFactory.
        meterRegistry - the Micrometer MeterRegistry to create meters on.
        Returns:
        the MatsMicrometerInterceptor instance which was installed as singleton.
      • install

        public static MatsMicrometerInterceptor install​(io.mats3.api.intercept.MatsInterceptable matsInterceptable)
        Installs a singleton instance of MatsMicrometerInterceptor which employs the Metrics.globalRegistry, on the provided MatsInterceptable (which most probably is a MatsFactory).
        Parameters:
        matsInterceptable - the MatsInterceptable to install on (probably a MatsFactory.
        Returns:
        the MatsMicrometerInterceptor instance which was installed as singleton.
      • initiateCompleted

        public void initiateCompleted​(io.mats3.api.intercept.MatsInitiateInterceptor.InitiateCompletedContext ctx)
        Specified by:
        initiateCompleted in interface io.mats3.api.intercept.MatsInitiateInterceptor
      • stageReceived

        public void stageReceived​(io.mats3.api.intercept.MatsStageInterceptor.StageReceivedContext ctx)
        Specified by:
        stageReceived in interface io.mats3.api.intercept.MatsStageInterceptor
      • stageCompleted

        public void stageCompleted​(io.mats3.api.intercept.MatsStageInterceptor.StageCompletedContext ctx)
        Specified by:
        stageCompleted in interface io.mats3.api.intercept.MatsStageInterceptor