Class Timer.Builder
- java.lang.Object
-
- org.forgerock.monitoring.api.instrument.Timer.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Timer.Builder
description(String description)
Timer.Builder
hierarchicalName(String hierarchicalName)
Timer.Builder
histogramBufferLength(Integer bufferLength)
Statistics emanating from a timer 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).Timer.Builder
histogramExpiry(Duration expiry)
Statistics emanating from a timer 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).Timer.Builder
maximumExpectedValue(Duration max)
Sets the maximum value that this timer is expected to observe.Timer.Builder
minimumExpectedValue(Duration min)
Sets the minimum value that this timer is expected to observe.Timer.Builder
pauseDetector(PauseDetector pauseDetector)
Sets the pause detector implementation to use for this timer.Timer.Builder
publishPercentileHistogram()
Adds histogram buckets usable for generating aggregable percentile approximations in monitoring systems that have query facilities to do so (e.g.Timer.Builder
publishPercentileHistogram(Boolean enabled)
Adds histogram buckets usable for generating aggregable percentile approximations in monitoring systems that have query facilities to do so (e.g.Timer.Builder
publishPercentiles(double... percentiles)
Produces an additional time series for each requested percentile.Timer
register(MeterRegistry registry)
Add the timer to a single registry, or return an existing timer in that registry.Timer.Builder
sla(Duration... sla)
Publish at a minimum a histogram containing your defined SLA boundaries.Timer.Builder
tag(String key, String value)
Timer.Builder
tags(Iterable<Tag> tags)
Timer.Builder
tags(String... tags)
-
-
-
Method Detail
-
tags
public Timer.Builder tags(String... tags)
- Parameters:
tags
- Must be an even number of arguments representing key/value pairs of tags.
-
tags
public Timer.Builder tags(Iterable<Tag> tags)
- Parameters:
tags
- Tags to add to the eventual meter.- Returns:
- The timer builder with added tags.
-
tag
public Timer.Builder tag(String key, String value)
- Parameters:
key
- The tag key.value
- The tag value.- Returns:
- The timer builder with a single added tag.
-
publishPercentiles
public Timer.Builder publishPercentiles(@Nullable double... percentiles)
Produces an additional time series for each requested percentile. This percentile is computed locally, and so can't be aggregated with percentiles computed across other dimensions (e.g. in a different instance). UsepublishPercentileHistogram()
to publish a histogram that can be used to generate aggregable percentile approximations.- Parameters:
percentiles
- Percentiles to compute and publish. The 95th percentile should be expressed as95.0
-
publishPercentileHistogram
public Timer.Builder publishPercentileHistogram()
Adds histogram buckets usable for generating aggregable percentile approximations in monitoring systems that have query facilities to do so (e.g. Prometheus'histogram_quantile
, Atlas':percentiles
).
-
publishPercentileHistogram
public Timer.Builder publishPercentileHistogram(@Nullable Boolean enabled)
Adds histogram buckets usable for generating aggregable percentile approximations in monitoring systems that have query facilities to do so (e.g. Prometheus'histogram_quantile
, Atlas':percentiles
).
-
sla
public Timer.Builder sla(@Nullable Duration... sla)
Publish at a minimum a histogram containing your defined SLA boundaries. When used in conjunction withpublishPercentileHistogram()
, the boundaries defined here are included alongside other buckets used to generate aggregable percentile approximations.- Parameters:
sla
- Publish SLA boundaries in the set of histogram buckets shipped to the monitoring system.
-
minimumExpectedValue
public Timer.Builder minimumExpectedValue(@Nullable Duration min)
Sets the minimum value that this timer is expected to observe. Sets a lower bound on histogram buckets that are shipped to monitoring systems that support aggregable percentile approximations.- Parameters:
min
- The minimum value that this timer is expected to observe.- Returns:
- This builder.
-
maximumExpectedValue
public Timer.Builder maximumExpectedValue(@Nullable Duration max)
Sets the maximum value that this timer is expected to observe. Sets an upper bound on histogram buckets that are shipped to monitoring systems that support aggregable percentile approximations.- Parameters:
max
- The maximum value that this timer is expected to observe.- Returns:
- This builder.
-
histogramExpiry
public Timer.Builder histogramExpiry(@Nullable Duration expiry)
Statistics emanating from a timer 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 ofhistogramBufferLength(Integer)
.- Parameters:
expiry
- The amount of time samples are accumulated to a histogram before it is reset and rotated.- Returns:
- This builder.
-
histogramBufferLength
public Timer.Builder histogramBufferLength(@Nullable Integer bufferLength)
Statistics emanating from a timer 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 afterhistogramExpiry(Duration)
, with this buffer length.- Parameters:
bufferLength
- The number of histograms to keep in the ring buffer.- Returns:
- This builder.
-
pauseDetector
public Timer.Builder pauseDetector(@Nullable PauseDetector pauseDetector)
Sets the pause detector implementation to use for this timer. Can also be configured on a registry-level withMeterRegistry.Config.pauseDetector(PauseDetector)
.- Parameters:
pauseDetector
- The pause detector implementation to use.- Returns:
- This builder.
- See Also:
- "io.micrometer.core.instrument.histogram.pause.NoPauseDetector", "io.micrometer.core.instrument.histogram.pause.ClockDriftPauseDetector"
-
description
public Timer.Builder description(@Nullable String description)
- Parameters:
description
- Description text of the eventual timer.- Returns:
- The timer builder with added description.
-
hierarchicalName
public Timer.Builder hierarchicalName(String hierarchicalName)
- Parameters:
hierarchicalName
- the hierarchical representation of the meter name- Returns:
- The timer builder with added hierarchical name.
-
register
public Timer register(MeterRegistry registry)
Add the timer to a single registry, or return an existing timer in that registry. The returned timer will be unique for each registry, but each registry is guaranteed to only create one timer for the same combination of name and tags.- Parameters:
registry
- A registry to add the timer to, if it doesn't already exist.- Returns:
- A new or existing timer.
-
-