Class StartupMetrics

java.lang.Object
org.forgerock.openig.util.StartupMetrics

public final class StartupMetrics extends Object
A utility class to capture startup metrics.
  • Method Details

    • startupMetricsBootstrap

      public static StartupMetrics startupMetricsBootstrap(org.forgerock.monitoring.api.instrument.MeterRegistry meterRegistry)
      Create a new instance of StartupMetrics to 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 of StartupMetrics.
      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 between starting() and started().
    • started

      public void started(Class<?> heapletClass)
      The component being measured has started. The startup metric will be recorded as the elapsed time between starting() and started(Class).
      Parameters:
      heapletClass - The Heaplet class created during startup to add to the recorded metric as a tag, can be null.
    • elapsedTime

      public Duration elapsedTime()
      Returns the current elapsed time since starting().
      Returns:
      the current elapsed time since starting().
    • deregister

      public void deregister()
      Deregister the startup metric when it is no longer required.