Class TimerCollector
- java.lang.Object
-
- org.kairosdb.metrics4j.collectors.helpers.TimerCollector
-
- All Implemented Interfaces:
Serializable,Collector,DurationCollector,MetricCollector,PostConstruct
- Direct Known Subclasses:
BagCollector,LastTime,NullCollector,PutCounter,SimpleTimerMetric
public abstract class TimerCollector extends Object implements DurationCollector
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimerCollector.ReportFormat-
Nested classes/interfaces inherited from interface org.kairosdb.metrics4j.collectors.DurationCollector
DurationCollector.TimeCallable<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>m_reportContextprotected TimeReporterm_timeReporter
-
Constructor Summary
Constructors Constructor Description TimerCollector()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Collectorclone()The first instance of a collector is unmarshalled from configuration using hocon, all other instances are cloned from that first one so the clone method should pass along any configuration that was set.TimerCollector.ReportFormatgetReportFormat()ChronoUnitgetReportUnit()voidsetContextProperties(Map<String,String> contextProperties)voidsetReportFormat(TimerCollector.ReportFormat reportFormat)Report format is either LONG or DOUBLE.voidsetReportUnit(ChronoUnit reportUnit)Unit to report metric as.BlockTimertime()<T> Ttime(DurationCollector.TimeCallable<T> callable)<T> TtimeEx(Callable<T> callable)-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.kairosdb.metrics4j.collectors.DurationCollector
put, put
-
Methods inherited from interface org.kairosdb.metrics4j.collectors.MetricCollector
reportMetric
-
Methods inherited from interface org.kairosdb.metrics4j.PostConstruct
init
-
-
-
-
Field Detail
-
m_timeReporter
protected TimeReporter m_timeReporter
-
-
Method Detail
-
setReportUnit
public void setReportUnit(ChronoUnit reportUnit)
Unit to report metric as. Supported units are NANOS, MICROS, MILLIS, SECONDS, MINUTES, HOURS, DAYS- Parameters:
reportUnit- Time unit
-
getReportUnit
public ChronoUnit getReportUnit()
-
setReportFormat
public void setReportFormat(TimerCollector.ReportFormat reportFormat)
Report format is either LONG or DOUBLE. Double truncates at 3 decimal places- Parameters:
reportFormat- Report format
-
getReportFormat
public TimerCollector.ReportFormat getReportFormat()
-
timeEx
public <T> T timeEx(Callable<T> callable) throws Exception
- Specified by:
timeExin interfaceDurationCollector- Throws:
Exception
-
time
public <T> T time(DurationCollector.TimeCallable<T> callable)
- Specified by:
timein interfaceDurationCollector
-
time
public BlockTimer time()
- Specified by:
timein interfaceDurationCollector
-
clone
public abstract Collector clone()
Description copied from interface:CollectorThe first instance of a collector is unmarshalled from configuration using hocon, all other instances are cloned from that first one so the clone method should pass along any configuration that was set.
-
setContextProperties
public void setContextProperties(Map<String,String> contextProperties)
- Specified by:
setContextPropertiesin interfaceMetricCollector
-
-