Class BaseReporterFactory

  • All Implemented Interfaces:
    Discoverable, ReporterFactory
    Direct Known Subclasses:
    BaseFormattedReporterFactory, GraphiteReporterFactory, Slf4jReporterFactory

    public abstract class BaseReporterFactory
    extends Object
    implements ReporterFactory
    A base ReporterFactory for configuring metric reporters.

    Configures options common to all ScheduledReporters.

    Configuration Parameters:

    Name Default Description
    durationUnit milliseconds The unit to report durations as. Overrides per-metric duration units.
    rateUnit seconds The unit to report rates as. Overrides per-metric rate units.
    excludes No excluded metrics. Metrics to exclude from reports, by name. When defined, matching metrics will not be reported. See getFilter().
    includes All metrics included. Metrics to include in reports, by name. When defined, only these metrics will be reported. See getFilter(). Exclusion rules (excludes) take precedence, so if a name matches both excludes and includes, it is excluded.
    excludesAttributes No excluded attributes. Metric attributes to exclude from reports, by name (e.g `p98`, `m15_rate`, `stddev`). When defined, matching metrics attributes will not be reported. See MetricAttribute
    includesAttributes All metrics attributes. Metrics attributes to include in reports, by name (e.g `p98`, `m15_rate`, `stddev`). When defined, only these attributes will be reported. See MetricAttribute. Exclusion rules (excludes) take precedence, so if an attribute matches both includesAttributes and excludesAttributes, it is excluded.
    useRegexFilters false Indicates whether the values of the 'includes' and 'excludes' fields should be treated as regular expressions or not.
    frequency none The frequency to report metrics. Overrides the default.
    • Constructor Detail

      • BaseReporterFactory

        public BaseReporterFactory()
    • Method Detail

      • getDurationUnit

        public TimeUnit getDurationUnit()
      • setDurationUnit

        public void setDurationUnit​(TimeUnit durationUnit)
      • getRateUnit

        public TimeUnit getRateUnit()
      • setRateUnit

        public void setRateUnit​(TimeUnit rateUnit)
      • getIncludes

        public Set<String> getIncludes()
      • setIncludes

        public void setIncludes​(Set<String> includes)
      • getExcludes

        public Set<String> getExcludes()
      • setExcludes

        public void setExcludes​(Set<String> excludes)
      • getUseRegexFilters

        public boolean getUseRegexFilters()
      • setUseRegexFilters

        public void setUseRegexFilters​(boolean useRegexFilters)
      • getUseSubstringMatching

        public boolean getUseSubstringMatching()
      • setUseSubstringMatching

        public void setUseSubstringMatching​(boolean useSubstringMatching)
      • getExcludesAttributes

        public EnumSet<com.codahale.metrics.MetricAttribute> getExcludesAttributes()
      • setExcludesAttributes

        public void setExcludesAttributes​(EnumSet<com.codahale.metrics.MetricAttribute> excludesAttributes)
      • getIncludesAttributes

        public EnumSet<com.codahale.metrics.MetricAttribute> getIncludesAttributes()
      • setIncludesAttributes

        public void setIncludesAttributes​(EnumSet<com.codahale.metrics.MetricAttribute> includesAttributes)
      • getFilter

        public com.codahale.metrics.MetricFilter getFilter()
        Gets a MetricFilter that specifically includes and excludes configured metrics.

        Filtering works in 4 ways:

        unfiltered
        All metrics are reported
        excludes-only
        All metrics are reported, except those whose name is listed in excludes.
        includes-only
        Only metrics whose name is listed in includes are reported.
        mixed (both includes and excludes
        Only metrics whose name is listed in includes and not listed in excludes are reported; excludes takes precedence over includes.
        Returns:
        the filter for selecting metrics based on the configured excludes/includes.
        See Also:
        getIncludes(), getExcludes()
      • getDisabledAttributes

        protected Set<com.codahale.metrics.MetricAttribute> getDisabledAttributes()