Package io.engineblock.metrics
Class HistoStatsLogger
- java.lang.Object
-
- io.engineblock.metrics.CapabilityHook<HdrDeltaHistogramAttachment>
-
- io.engineblock.metrics.HistoStatsLogger
-
- All Implemented Interfaces:
com.codahale.metrics.MetricRegistryListener,MetricsCloseable,java.lang.Runnable,java.util.EventListener
public class HistoStatsLogger extends CapabilityHook<HdrDeltaHistogramAttachment> implements java.lang.Runnable, MetricsCloseable
HistoIntervalLogger runs a separate thread to snapshotAndWrite encoded histograms on a regular interval. It listens to the metrics registry for any new metrics that match the pattern. Any metrics which both match the pattern and which areEncodableHistograms are written the configured logfile at the configured interval.
-
-
Constructor Summary
Constructors Constructor Description HistoStatsLogger(java.lang.String sessionName, java.io.File file, java.util.regex.Pattern pattern, long intervalLength, java.util.concurrent.TimeUnit timeUnit)
-
Method Summary
Modifier and Type Method Description voidchart()voidcloseMetrics()protected java.lang.Class<HdrDeltaHistogramAttachment>getCapabilityClass()longgetInterval()booleanmatches(java.lang.String metricName)voidonCapableAdded(java.lang.String name, HdrDeltaHistogramAttachment chainedHistogram)voidonCapableRemoved(java.lang.String name, HdrDeltaHistogramAttachment capable)voidrun()voidstartLogging()By convention, it is typical for the logging application to use a comment to indicate the logging application at the head of the log, followed by the log format version, a startLogging time, and a legend (in that order).java.lang.StringtoString()-
Methods inherited from class io.engineblock.metrics.CapabilityHook
onCounterAdded, onCounterRemoved, onGaugeAdded, onGaugeRemoved, onHistogramAdded, onHistogramRemoved, onMeterAdded, onMeterRemoved, onTimerAdded, onTimerRemoved
-
-
-
-
Method Detail
-
matches
public boolean matches(java.lang.String metricName)
-
startLogging
public void startLogging()
By convention, it is typical for the logging application to use a comment to indicate the logging application at the head of the log, followed by the log format version, a startLogging time, and a legend (in that order).
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getInterval
public long getInterval()
-
onCapableAdded
public void onCapableAdded(java.lang.String name, HdrDeltaHistogramAttachment chainedHistogram)- Specified by:
onCapableAddedin classCapabilityHook<HdrDeltaHistogramAttachment>
-
onCapableRemoved
public void onCapableRemoved(java.lang.String name, HdrDeltaHistogramAttachment capable)- Specified by:
onCapableRemovedin classCapabilityHook<HdrDeltaHistogramAttachment>
-
getCapabilityClass
protected java.lang.Class<HdrDeltaHistogramAttachment> getCapabilityClass()
- Specified by:
getCapabilityClassin classCapabilityHook<HdrDeltaHistogramAttachment>
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
closeMetrics
public void closeMetrics()
- Specified by:
closeMetricsin interfaceMetricsCloseable
-
chart
public void chart()
- Specified by:
chartin interfaceMetricsCloseable
-
-