Class MetricsService

java.lang.Object
com.nt.udc.util.misc.metrics.MetricsService

public class MetricsService extends Object
This class creates a Prometheus registry and http metrics service endpoint that can be scraped for ECE application, Coherence, JVM, and system metrics.
  • Field Details

    • METRICS_SERVICE_PATH

      public static final String METRICS_SERVICE_PATH
      HTTP path that metrics will be served on.
      See Also:
    • METRICS_HTTP_PORT_DEFAULT

      public static final String METRICS_HTTP_PORT_DEFAULT
      Default por the metrics HTTP server will listen on.
      See Also:
    • METRICS_HTTP_PORT_PROPERTY_NAME

      public static final String METRICS_HTTP_PORT_PROPERTY_NAME
      Property used to configure the HTTP Metrics port.
      See Also:
    • METRICS_SERVICE_ENABLED_DEFAULT

      public static final String METRICS_SERVICE_ENABLED_DEFAULT
      Default property used to indicate if the HTTP Metric server is enabled.
      See Also:
    • METRICS_HTTP_SERVICE_ENABLED_PROPERTY_NAME

      public static final String METRICS_HTTP_SERVICE_ENABLED_PROPERTY_NAME
      Property used to control if the metric server is enabled (true) or disabled.
      See Also:
    • METRICS_APPLICATION_ROLE_TAG

      public static final String METRICS_APPLICATION_ROLE_TAG
      Tag name to use to distinguish between application components.
      See Also:
  • Constructor Details

    • MetricsService

      public MetricsService()
      Public default constructor.
  • Method Details

    • setCommonTags

      public MetricsService setCommonTags(List<io.micrometer.core.instrument.Tag> tagList)
      Adds a list of Common Tags to the registry. All metrics will include these tags.
      Parameters:
      tagList - List of Tags to apply to all metrics.
      Returns:
      the metric service
    • setApplicationRole

      public MetricsService setApplicationRole(String applicationName)
      Add the Application tag to the registry. This will be added to all metrics.
      Parameters:
      applicationName - name of the application
      Returns:
      the metric service
    • setCommonTags

      public MetricsService setCommonTags()
    • setCommonTags

      public MetricsService setCommonTags(Map<String,String> tagMap)
    • bindAllMetrics

      public MetricsService bindAllMetrics()
      Creates the PrometheusMeterRegistry and binds the following component metrics to it so they are also provided when the service is scraped. 1) Coherence Metrics 2) JVM GC Metrics 3) JVM Thread Metrics 4) Processor Metrics
      Returns:
      This MetricsService instance.
    • startMetricsHttpService

      public boolean startMetricsHttpService()
      Starts the ECE Prometheus metrics service endpoint which provides metrics from the ECE application and other components using a common Prometheus registry.
      Returns:
      True if the service is started or already started. False if the configuration property ece.metrics.http.service.enabled is false or the service fails to start.
    • getMetricsHttpPort

      public int getMetricsHttpPort()
      Get the metrics http port the service is running on.
      Returns:
      The configured http port
    • isMetricsHttpServiceEnabled

      public boolean isMetricsHttpServiceEnabled()
      Get the enabled status of this metrics service.
      Returns:
      true if the service is enabled, false otherwise.
    • setNM

      public void setNM(com.nt.udc.nodemgr.OSANodeMgr inNM)
    • setLogger

      public MetricsService setLogger(Logger logger)