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 java.lang.Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBeanManages 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 enabledmetrics.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 givenMetricsReporterFactoryimplementationmetrics.reporter.<reporterName>.period.seconds- defines the period (in seconds) how often metrics should be reported
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_METRICS_REPORTER_FILTER_VALUEstatic java.time.DurationDEFAULT_METRICS_REPORTER_PERIOD_SECONDS_VALUEstatic java.lang.StringMETRICS_REPORTER_ENABLEDstatic java.lang.StringMETRICS_REPORTER_FILTERstatic java.lang.StringMETRICS_REPORTER_PERIOD_SECONDS
-
Constructor Summary
Constructors Constructor Description MetricsReporterService(com.codahale.metrics.MetricRegistry registry, java.lang.String reporterName, MetricsReporterFactory metricsReporterFactory)The constructor for the metric report service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected java.util.concurrent.ScheduledExecutorServicecreateDefaultExecutor(java.lang.String name, java.lang.String tenantID)voiddestroy()java.util.Map<java.lang.String,java.lang.String>getReporterFilters()java.time.DurationgetReportingPeriod()booleanisReporterEnabled()
-
-
-
Field Detail
-
METRICS_REPORTER_ENABLED
public static final java.lang.String METRICS_REPORTER_ENABLED
- See Also:
- Constant Field Values
-
METRICS_REPORTER_FILTER
public static final java.lang.String METRICS_REPORTER_FILTER
- See Also:
- Constant Field Values
-
METRICS_REPORTER_PERIOD_SECONDS
public static final java.lang.String METRICS_REPORTER_PERIOD_SECONDS
- See Also:
- Constant Field Values
-
DEFAULT_METRICS_REPORTER_PERIOD_SECONDS_VALUE
public static final java.time.Duration DEFAULT_METRICS_REPORTER_PERIOD_SECONDS_VALUE
-
DEFAULT_METRICS_REPORTER_FILTER_VALUE
public static final java.lang.String DEFAULT_METRICS_REPORTER_FILTER_VALUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetricsReporterService
public MetricsReporterService(com.codahale.metrics.MetricRegistry registry, java.lang.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 metricsreporterName- name of the reporter - it is used to determine the properties that will be used to configure the reportermetricsReporterFactory- the factory that will create the reporter any time it is required
-
-
Method Detail
-
getReportingPeriod
public java.time.Duration getReportingPeriod()
-
isReporterEnabled
public boolean isReporterEnabled()
-
getReporterFilters
public java.util.Map<java.lang.String,java.lang.String> getReporterFilters()
-
createDefaultExecutor
protected java.util.concurrent.ScheduledExecutorService createDefaultExecutor(java.lang.String name, java.lang.String tenantID)
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
-