Class MetricsProperties

java.lang.Object
io.prometheus.metrics.config.MetricsProperties

public class MetricsProperties extends Object
Properties starting with io.prometheus.metrics
  • Field Details

    • EXEMPLARS_ENABLED

      private static final String EXEMPLARS_ENABLED
      See Also:
    • HISTOGRAM_NATIVE_ONLY

      private static final String HISTOGRAM_NATIVE_ONLY
      See Also:
    • HISTOGRAM_CLASSIC_ONLY

      private static final String HISTOGRAM_CLASSIC_ONLY
      See Also:
    • HISTOGRAM_CLASSIC_UPPER_BOUNDS

      private static final String HISTOGRAM_CLASSIC_UPPER_BOUNDS
      See Also:
    • HISTOGRAM_NATIVE_INITIAL_SCHEMA

      private static final String HISTOGRAM_NATIVE_INITIAL_SCHEMA
      See Also:
    • HISTOGRAM_NATIVE_MIN_ZERO_THRESHOLD

      private static final String HISTOGRAM_NATIVE_MIN_ZERO_THRESHOLD
      See Also:
    • HISTOGRAM_NATIVE_MAX_ZERO_THRESHOLD

      private static final String HISTOGRAM_NATIVE_MAX_ZERO_THRESHOLD
      See Also:
    • HISTOGRAM_NATIVE_MAX_NUMBER_OF_BUCKETS

      private static final String HISTOGRAM_NATIVE_MAX_NUMBER_OF_BUCKETS
      See Also:
    • HISTOGRAM_NATIVE_RESET_DURATION_SECONDS

      private static final String HISTOGRAM_NATIVE_RESET_DURATION_SECONDS
      See Also:
    • SUMMARY_QUANTILES

      private static final String SUMMARY_QUANTILES
      See Also:
    • SUMMARY_QUANTILE_ERRORS

      private static final String SUMMARY_QUANTILE_ERRORS
      See Also:
    • SUMMARY_MAX_AGE_SECONDS

      private static final String SUMMARY_MAX_AGE_SECONDS
      See Also:
    • SUMMARY_NUMBER_OF_AGE_BUCKETS

      private static final String SUMMARY_NUMBER_OF_AGE_BUCKETS
      See Also:
    • PROPERTY_SUFFIXES

      static final String[] PROPERTY_SUFFIXES
      All known property suffixes that can be configured for metrics.

      This list is used to parse metric-specific configuration keys from environment variables.

    • exemplarsEnabled

      private final Boolean exemplarsEnabled
    • histogramNativeOnly

      private final Boolean histogramNativeOnly
    • histogramClassicOnly

      private final Boolean histogramClassicOnly
    • histogramClassicUpperBounds

      private final List<Double> histogramClassicUpperBounds
    • histogramNativeInitialSchema

      private final Integer histogramNativeInitialSchema
    • histogramNativeMinZeroThreshold

      private final Double histogramNativeMinZeroThreshold
    • histogramNativeMaxZeroThreshold

      private final Double histogramNativeMaxZeroThreshold
    • histogramNativeMaxNumberOfBuckets

      private final Integer histogramNativeMaxNumberOfBuckets
    • histogramNativeResetDurationSeconds

      private final Long histogramNativeResetDurationSeconds
    • summaryQuantiles

      private final List<Double> summaryQuantiles
    • summaryQuantileErrors

      private final List<Double> summaryQuantileErrors
    • summaryMaxAgeSeconds

      private final Long summaryMaxAgeSeconds
    • summaryNumberOfAgeBuckets

      private final Integer summaryNumberOfAgeBuckets
  • Constructor Details

    • MetricsProperties

      public MetricsProperties(Boolean exemplarsEnabled, Boolean histogramNativeOnly, Boolean histogramClassicOnly, List<Double> histogramClassicUpperBounds, Integer histogramNativeInitialSchema, Double histogramNativeMinZeroThreshold, Double histogramNativeMaxZeroThreshold, Integer histogramNativeMaxNumberOfBuckets, Long histogramNativeResetDurationSeconds, List<Double> summaryQuantiles, List<Double> summaryQuantileErrors, Long summaryMaxAgeSeconds, Integer summaryNumberOfAgeBuckets)
    • MetricsProperties

      private MetricsProperties(Boolean exemplarsEnabled, Boolean histogramNativeOnly, Boolean histogramClassicOnly, List<Double> histogramClassicUpperBounds, Integer histogramNativeInitialSchema, Double histogramNativeMinZeroThreshold, Double histogramNativeMaxZeroThreshold, Integer histogramNativeMaxNumberOfBuckets, Long histogramNativeResetDurationSeconds, List<Double> summaryQuantiles, List<Double> summaryQuantileErrors, Long summaryMaxAgeSeconds, Integer summaryNumberOfAgeBuckets, String configPropertyPrefix)
  • Method Details

    • isHistogramClassicOnly

      private Boolean isHistogramClassicOnly(Boolean histogramClassicOnly, Boolean histogramNativeOnly)
    • isHistogramNativeOnly

      private Boolean isHistogramNativeOnly(Boolean histogramClassicOnly, Boolean histogramNativeOnly)
    • validate

      private void validate(String prefix) throws PrometheusPropertiesException
      Throws:
      PrometheusPropertiesException
    • getExemplarsEnabled

      public Boolean getExemplarsEnabled()
      This is the only configuration property that can be applied to all metric types. You can use it to turn Exemplar support off. Default is true.
    • getHistogramNativeOnly

      public Boolean getHistogramNativeOnly()
      See Histogram.Builder.nativeOnly()
    • getHistogramClassicOnly

      public Boolean getHistogramClassicOnly()
      See Histogram.Builder.classicOnly()
    • getHistogramClassicUpperBounds

      public List<Double> getHistogramClassicUpperBounds()
      See Histogram.Builder.classicUpperBounds()
    • getHistogramNativeInitialSchema

      public Integer getHistogramNativeInitialSchema()
      See Histogram.Builder.nativeInitialSchema()
    • getHistogramNativeMinZeroThreshold

      public Double getHistogramNativeMinZeroThreshold()
      See Histogram.Builder.nativeMinZeroThreshold()
    • getHistogramNativeMaxZeroThreshold

      public Double getHistogramNativeMaxZeroThreshold()
      See Histogram.Builder.nativeMaxZeroThreshold()
    • getHistogramNativeMaxNumberOfBuckets

      public Integer getHistogramNativeMaxNumberOfBuckets()
      See Histogram.Builder.nativeMaxNumberOfBuckets()
    • getHistogramNativeResetDurationSeconds

      public Long getHistogramNativeResetDurationSeconds()
      See Histogram.Builder.nativeResetDuration()
    • getSummaryQuantiles

      public List<Double> getSummaryQuantiles()
      See Summary.Builder.quantile()
    • getSummaryQuantileErrors

      public List<Double> getSummaryQuantileErrors()
      See Summary.Builder.quantile()

      Returns null only if getSummaryQuantiles() is also null. Returns an empty list if getSummaryQuantiles() are specified without specifying errors. If the list is not empty, it has the same size as getSummaryQuantiles().

    • getSummaryMaxAgeSeconds

      public Long getSummaryMaxAgeSeconds()
      See Summary.Builder.maxAgeSeconds()
    • getSummaryNumberOfAgeBuckets

      public Integer getSummaryNumberOfAgeBuckets()
      See Summary.Builder.numberOfAgeBuckets()
    • load

      static MetricsProperties load(String prefix, PropertySource propertySource) throws PrometheusPropertiesException
      Note that this will remove entries from propertySource. This is because we want to know if there are unused properties remaining after all properties have been loaded.
      Throws:
      PrometheusPropertiesException
    • builder

      public static MetricsProperties.Builder builder()