Class MetricsReporterService

java.lang.Object
de.hybris.platform.metrics.dropwizard.MetricsReporterService
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class MetricsReporterService extends Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

Manages the logging of metrics.

You can configure the following parameters of the custom metrics reporter service:

  • metrics.reporter.<reporterName>.enabled - defines whether reporting of metrics should be enabled
  • metrics.reporter.<reporterName>.filter.* - defines the SpEL expressions used to filter the names of metrics reported periodically. The way of handling the multiple filters defined in properties is defined by given MetricsReporterFactory implementation
  • metrics.reporter.<reporterName>.period.seconds - defines the period (in seconds) how often metrics should be reported

  • Field Details

    • METRICS_REPORTER_ENABLED

      public static final String METRICS_REPORTER_ENABLED
      See Also:
    • METRICS_REPORTER_FILTER

      public static final String METRICS_REPORTER_FILTER
      See Also:
    • METRICS_REPORTER_PERIOD_SECONDS

      public static final String METRICS_REPORTER_PERIOD_SECONDS
      See Also:
    • DEFAULT_METRICS_REPORTER_PERIOD_SECONDS_VALUE

      public static final Duration DEFAULT_METRICS_REPORTER_PERIOD_SECONDS_VALUE
    • DEFAULT_METRICS_REPORTER_FILTER_VALUE

      public static final String DEFAULT_METRICS_REPORTER_FILTER_VALUE
      See Also:
  • Constructor Details

    • MetricsReporterService

      public MetricsReporterService(com.codahale.metrics.MetricRegistry registry, String reporterName, MetricsReporterFactory metricsReporterFactory)
      The constructor for the metric report service. The service will check the config properties and manage the reporter (start/stop/update)
      Parameters:
      registry - the metric registry that should be used to report metrics
      reporterName - name of the reporter - it is used to determine the properties that will be used to configure the reporter
      metricsReporterFactory - the factory that will create the reporter any time it is required
  • Method Details

    • getReportingPeriod

      public Duration getReportingPeriod()
    • isReporterEnabled

      public boolean isReporterEnabled()
    • getReporterFilters

      public Map<String,String> getReporterFilters()
    • createDefaultExecutor

      protected ScheduledExecutorService createDefaultExecutor(String name, String tenantID)
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean