Class StartupTimeMetricsListener

java.lang.Object
org.springframework.boot.actuate.metrics.startup.StartupTimeMetricsListener
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, org.springframework.context.event.SmartApplicationListener, org.springframework.core.Ordered

public class StartupTimeMetricsListener extends Object implements org.springframework.context.event.SmartApplicationListener
Binds application startup metrics in response to ApplicationStartedEvent and ApplicationReadyEvent.
Since:
2.6.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The default name to use for the application ready time metric.
    static final String
    The default name to use for the application started time metric.

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    StartupTimeMetricsListener(io.micrometer.core.instrument.MeterRegistry meterRegistry)
    Create a new instance using default metric names.
    StartupTimeMetricsListener(io.micrometer.core.instrument.MeterRegistry meterRegistry, String startedTimeMetricName, String readyTimeMetricName, Iterable<io.micrometer.core.instrument.Tag> tags)
    Create a new instance using the specified options.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onApplicationEvent(org.springframework.context.ApplicationEvent event)
     
    boolean
    supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> 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.event.SmartApplicationListener

    getListenerId, getOrder, supportsSourceType
  • Field Details

    • APPLICATION_STARTED_TIME_METRIC_NAME

      public static final String APPLICATION_STARTED_TIME_METRIC_NAME
      The default name to use for the application started time metric.
      See Also:
    • APPLICATION_READY_TIME_METRIC_NAME

      public static final String APPLICATION_READY_TIME_METRIC_NAME
      The default name to use for the application ready time metric.
      See Also:
  • Constructor Details

    • StartupTimeMetricsListener

      public StartupTimeMetricsListener(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Create a new instance using default metric names.
      Parameters:
      meterRegistry - the registry to use
      See Also:
    • StartupTimeMetricsListener

      public StartupTimeMetricsListener(io.micrometer.core.instrument.MeterRegistry meterRegistry, String startedTimeMetricName, String readyTimeMetricName, Iterable<io.micrometer.core.instrument.Tag> tags)
      Create a new instance using the specified options.
      Parameters:
      meterRegistry - the registry to use
      startedTimeMetricName - the name to use for the application started time metric
      readyTimeMetricName - the name to use for the application ready time metric
      tags - the tags to associate to application startup metrics
  • Method Details

    • supportsEventType

      public boolean supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType)
      Specified by:
      supportsEventType in interface org.springframework.context.event.SmartApplicationListener
    • onApplicationEvent

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