Package org.forgerock.openig.util
Class StartupMetrics
java.lang.Object
org.forgerock.openig.util.StartupMetrics
A utility class to capture startup metrics.
-
Method Summary
Modifier and TypeMethodDescriptioncreateChild(String id, String kind, String description, String... additionalMetadata) Create a child instance ofStartupMetrics.voidDeregister the startup metric when it is no longer required.Returns the current elapsed time sincestarting().voidstarted()The component being measured has started.voidThe component being measured has started.voidstarting()The component being measured is starting.static StartupMetricsstartupMetricsBootstrap(org.forgerock.monitoring.api.instrument.MeterRegistry meterRegistry) Create a new instance ofStartupMetricsto act as the top-level startup metric.
-
Method Details
-
startupMetricsBootstrap
public static StartupMetrics startupMetricsBootstrap(org.forgerock.monitoring.api.instrument.MeterRegistry meterRegistry) Create a new instance ofStartupMetricsto act as the top-level startup metric.- Parameters:
meterRegistry- The meter registry to use.- Returns:
- a new instance of
StartupMetrics.
-
createChild
public StartupMetrics createChild(String id, String kind, String description, String... additionalMetadata) Create a child instance ofStartupMetrics.- Parameters:
id- The identifier of the child metric.kind- The kind of the child metric.description- The description of the child metric.additionalMetadata- Additional metadata to add to the child metric.- Returns:
- a new instance of
StartupMetrics.
-
starting
public void starting()The component being measured is starting. -
started
public void started()The component being measured has started. The startup metric will be recorded as the elapsed time betweenstarting()andstarted(). -
started
The component being measured has started. The startup metric will be recorded as the elapsed time betweenstarting()andstarted(Class).- Parameters:
heapletClass- TheHeapletclass created during startup to add to the recorded metric as a tag, can benull.
-
elapsedTime
Returns the current elapsed time sincestarting().- Returns:
- the current elapsed time since
starting()
-
deregister
public void deregister()Deregister the startup metric when it is no longer required.
-