Skip to content

Instantly share code, notes, and snippets.

@jkschneider
Created January 17, 2018 22:39
Show Gist options
  • Save jkschneider/5aedd93fb1de52cc862e89b67fdb35b8 to your computer and use it in GitHub Desktop.
Save jkschneider/5aedd93fb1de52cc862e89b67fdb35b8 to your computer and use it in GitHub Desktop.
Properties POJOs for MeterFilter configuration
package io.micrometer.core.instrument.config;
import java.time.Duration;
/**
* Filter properties that are common to both distribution summaries and timers.
*/
public abstract class DistributionFilterProperties extends MeterFilterProperties {
/**
* Controls whether to publish a histogram structure for those monitoring systems that support
* aggregable percentile calculation based on a histogram. For other systems, this has no effect.
*/
Boolean percentileHistogram;
/**
* The set of Micrometer-computed non-aggregable percentiles to ship to the backend. Percentiles should
* be defined in the range of (0, 1]. For example, 0.999 represents the 99.9th percentile of the distribution.
*/
double[] percentiles;
/**
* Statistics emanating from a distribution like max, percentiles, and histogram counts decay over time to
* give greater weight to recent samples (exception: histogram counts are cumulative for those systems that expect cumulative
* histogram buckets). Samples are accumulated to such statistics in ring buffers which rotate after
* this expiry, with a buffer length of {@link DistributionFilterProperties#histogramBufferLength}.
*/
Duration histogramExpiry;
/**
* Statistics emanating from a distribution like max, percentiles, and histogram counts decay over time to
* give greater weight to recent samples (exception: histogram counts are cumulative for those systems that expect cumulative
* histogram buckets). Samples are accumulated to such statistics in ring buffers which rotate after
* {@link DistributionFilterProperties#histogramExpiry}, with this buffer length.
*/
Integer histogramBufferLength;
public Boolean getPercentileHistogram() {
return percentileHistogram;
}
public void setPercentileHistogram(Boolean percentileHistogram) {
this.percentileHistogram = percentileHistogram;
}
public double[] getPercentiles() {
return percentiles;
}
public void setPercentiles(double[] percentiles) {
this.percentiles = percentiles;
}
public Duration getHistogramExpiry() {
return histogramExpiry;
}
public void setHistogramExpiry(Duration histogramExpiry) {
this.histogramExpiry = histogramExpiry;
}
public Integer getHistogramBufferLength() {
return histogramBufferLength;
}
public void setHistogramBufferLength(Integer histogramBufferLength) {
this.histogramBufferLength = histogramBufferLength;
}
}
package io.micrometer.core.instrument.config;
public class DistributionSummaryFilterProperties extends DistributionFilterProperties {
/**
* Clamps {@link DistributionFilterProperties#percentileHistogram} to the first percentile bucket greater than
* or equal to the supplied value. Use this property to control the number of histogram buckets used
* to represent a distribution.
*/
Long minimumExpectedValue;
/**
* Clamps {@link DistributionFilterProperties#percentileHistogram} to the percentile buckets less than
* or equal to the supplied value. Use this property to control the number of histogram buckets used
* to represent a distribution.
*/
Long maximumExpectedValue;
/**
* Publish a counter for each SLA boundary that counts violations of the SLA.
*/
long[] sla;
public Long getMinimumExpectedValue() {
return minimumExpectedValue;
}
public void setMinimumExpectedValue(Long minimumExpectedValue) {
this.minimumExpectedValue = minimumExpectedValue;
}
public Long getMaximumExpectedValue() {
return maximumExpectedValue;
}
public void setMaximumExpectedValue(Long maximumExpectedValue) {
this.maximumExpectedValue = maximumExpectedValue;
}
public long[] getSla() {
return sla;
}
public void setSla(long[] sla) {
this.sla = sla;
}
}
package io.micrometer.core.instrument.config;
/**
* Filter properties that are applicable to all {@link io.micrometer.core.instrument.Meter} types.
*/
public class MeterFilterProperties {
/**
* If <pre>false</pre>, the matching meter(s) are no-op.
*/
Boolean enabled;
}
package io.micrometer.core.instrument.config;
import java.time.Duration;
public class TimerFilterProperties extends DistributionFilterProperties {
/**
* Clamps {@link DistributionFilterProperties#percentileHistogram} to the first percentile bucket greater than
* or equal to the supplied value. Use this property to control the number of histogram buckets used
* to represent a distribution.
*/
Duration minimumExpectedValue;
/**
* Clamps {@link DistributionFilterProperties#percentileHistogram} to the percentile buckets less than
* or equal to the supplied value. Use this property to control the number of histogram buckets used
* to represent a distribution.
*/
Duration maximumExpectedValue;
/**
* Publish a counter for each SLA boundary that counts violations of the SLA.
*/
Duration[] sla;
public Duration getMinimumExpectedValue() {
return minimumExpectedValue;
}
public Duration getMaximumExpectedValue() {
return maximumExpectedValue;
}
public Duration[] getSla() {
return sla;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment