Class IntervalMetricReader
- java.lang.Object
-
- io.opencensus.exporter.metrics.util.IntervalMetricReader
-
public final class IntervalMetricReader extends java.lang.ObjectWrapper of theMetricReaderwhich automatically reads and exports the metrics every export interval.- Since:
- 0.19
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIntervalMetricReader.OptionsOptions forIntervalMetricReader.private static classIntervalMetricReader.Worker
-
Field Summary
Fields Modifier and Type Field Description (package private) static DurationDEFAULT_INTERVALprivate IntervalMetricReader.Workerworkerprivate java.lang.ThreadworkerThreadprivate static DurationZERO
-
Constructor Summary
Constructors Modifier Constructor Description privateIntervalMetricReader(IntervalMetricReader.Worker worker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IntervalMetricReadercreate(MetricExporter metricExporter, MetricReader metricReader, IntervalMetricReader.Options options)Creates a newIntervalMetricReader.voidreadAndExportNow()Reads and exports data immediately.voidstop()Stops the worker thread by callingThread.interrupt().
-
-
-
Field Detail
-
DEFAULT_INTERVAL
static final Duration DEFAULT_INTERVAL
-
ZERO
private static final Duration ZERO
-
workerThread
private final java.lang.Thread workerThread
-
worker
private final IntervalMetricReader.Worker worker
-
-
Constructor Detail
-
IntervalMetricReader
private IntervalMetricReader(IntervalMetricReader.Worker worker)
-
-
Method Detail
-
create
public static IntervalMetricReader create(MetricExporter metricExporter, MetricReader metricReader, IntervalMetricReader.Options options)
Creates a newIntervalMetricReader.- Parameters:
metricExporter- theMetricExporterto be called after.metricReader- theMetricReaderto be used to read metrics.options- theIntervalMetricReader.Optionsfor the newIntervalMetricReader.- Returns:
- a new
IntervalMetricReader. - Since:
- 0.19
-
readAndExportNow
public void readAndExportNow()
Reads and exports data immediately.- Since:
- 0.19
-
stop
public void stop()
Stops the worker thread by callingThread.interrupt().- Since:
- 0.19
-
-