Class IntervalMetricReader
- java.lang.Object
-
- io.opencensus.exporter.metrics.util.IntervalMetricReader
-
public final class IntervalMetricReader extends java.lang.Object
Wrapper of theMetricReader
which automatically reads and exports the metrics every export interval.- Since:
- 0.19
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IntervalMetricReader.Options
Options forIntervalMetricReader
.private static class
IntervalMetricReader.Worker
-
Field Summary
Fields Modifier and Type Field Description (package private) static Duration
DEFAULT_INTERVAL
private IntervalMetricReader.Worker
worker
private java.lang.Thread
workerThread
private static Duration
ZERO
-
Constructor Summary
Constructors Modifier Constructor Description private
IntervalMetricReader(IntervalMetricReader.Worker worker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IntervalMetricReader
create(MetricExporter metricExporter, MetricReader metricReader, IntervalMetricReader.Options options)
Creates a newIntervalMetricReader
.void
readAndExportNow()
Reads and exports data immediately.void
stop()
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
- theMetricExporter
to be called after.metricReader
- theMetricReader
to be used to read metrics.options
- theIntervalMetricReader.Options
for 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
-
-