public class TimeWindowCounterBuilder
extends java.lang.Object
TimeWindowCounters
with a specific and consistent set of TimeWindows
, and in turn produce PollingMonitoredValues
which watch those TimeWindowCounters. Can either
create the TimeWindowCounters from scratch, or 'copy' an existing
MonitoredCounter.Modifier and Type | Field and Description |
---|---|
private MonitorableRegistry |
registry |
private com.google.common.base.Supplier<java.lang.Long> |
timeSource |
private java.util.List<TimeWindow> |
timeWindows |
Constructor and Description |
---|
TimeWindowCounterBuilder(MonitorableRegistry registry,
TimeWindow... windows) |
TimeWindowCounterBuilder(com.google.common.base.Supplier<java.lang.Long> timeSource,
MonitorableRegistry registry,
TimeWindow... windows) |
Modifier and Type | Method and Description |
---|---|
CompositeCounter |
build(java.lang.String baseName,
java.lang.String baseDescription,
javax.measure.Unit<?> unit)
Builds a new
CompositeCounter , comprised of TimeWindowCounters,
and registers PollingMonitoredValue s to detect changes in their
values. |
CompositeCounter |
copyFrom(MonitoredCounter templateCounter)
Creates a new CompositeCounter wrapping TimeWindowCounters (and creating
PollingMonitoredValues), using the supplied counter's name,
description, and unit as the template.
|
private java.util.List<Counter> |
getSubCounters(java.lang.String baseName,
java.lang.String baseDescription,
javax.measure.Unit<?> unit) |
CompositeCounter |
wrapCounter(MonitoredCounter templateCounter)
Creates a new CompositeCounter wrapping TimeWindowCounters (and creating
PollingMonitoredValues), using the supplied MonitoredCounter's name,
description, and unit as the template.
|
private final java.util.List<TimeWindow> timeWindows
private final com.google.common.base.Supplier<java.lang.Long> timeSource
private final MonitorableRegistry registry
public TimeWindowCounterBuilder(MonitorableRegistry registry, TimeWindow... windows)
TimeWindowCounterBuilder(com.google.common.base.Supplier<java.lang.Long> timeSource, MonitorableRegistry registry, TimeWindow... windows)
public CompositeCounter build(java.lang.String baseName, java.lang.String baseDescription, javax.measure.Unit<?> unit)
CompositeCounter
, comprised of TimeWindowCounters,
and registers PollingMonitoredValue
s to detect changes in their
values.baseName
- the base name of the new MonitoredValues, which will have the
window name, e.g. ".60s", appended to it for each windowbaseDescription
- the base description of the new MonitoredValues, to be
appended with e.g. " [60s]"unit
- the Unit
to use for the new valuesprivate java.util.List<Counter> getSubCounters(java.lang.String baseName, java.lang.String baseDescription, javax.measure.Unit<?> unit)
public CompositeCounter copyFrom(MonitoredCounter templateCounter)
templateCounter
- a MonitoredCounter whose name, description, and unit should be
copiedpublic CompositeCounter wrapCounter(MonitoredCounter templateCounter)
templateCounter
- a Counter whose name, description, and unit should be copied