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
FieldsModifier and TypeFieldDescriptionstatic final StringThe default name to use for the application ready time metric.static final StringThe default name to use for the application started time metric.Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionStartupTimeMetricsListener(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 TypeMethodDescriptionvoidonApplicationEvent(org.springframework.context.ApplicationEvent event) booleansupportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecutionMethods inherited from interface org.springframework.context.event.SmartApplicationListener
getListenerId, getOrder, supportsSourceType
-
Field Details
-
APPLICATION_STARTED_TIME_METRIC_NAME
The default name to use for the application started time metric.- See Also:
-
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 usestartedTimeMetricName- the name to use for the application started time metricreadyTimeMetricName- the name to use for the application ready time metrictags- the tags to associate to application startup metrics
-
-
Method Details
-
supportsEventType
public boolean supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType) - Specified by:
supportsEventTypein interfaceorg.springframework.context.event.SmartApplicationListener
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
-