@NotThreadSafe public class StackdriverWriter extends Object implements MetricWriter
This class communicates with the API via HTTP. In order to increase throughput and minimize
CPU, it buffers points to be written until it has maxPointsPerRequest points buffered or
until flush() is called.
| Constructor and Description |
|---|
StackdriverWriter(com.google.api.services.monitoring.v3.Monitoring monitoringClient,
String project,
com.google.api.services.monitoring.v3.model.MonitoredResource monitoredResource,
int maxQps,
int maxPointsPerRequest)
Constructs a
StackdriverWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flushes all buffered metric points to Stackdriver.
|
<V> void |
write(MetricPoint<V> point)
Encodes and writes a metric point to Stackdriver.
|
public StackdriverWriter(com.google.api.services.monitoring.v3.Monitoring monitoringClient,
String project,
com.google.api.services.monitoring.v3.model.MonitoredResource monitoredResource,
int maxQps,
int maxPointsPerRequest)
StackdriverWriter.
The monitoringClient must have read and write permissions to the Cloud Monitoring API v3 on the provided project.
public <V> void write(MetricPoint<V> point) throws IOException
write in interface MetricWriterIOExceptionpublic void flush()
throws IOException
flush in interface MetricWriterflush in interface FlushableIOExceptionCopyright © 2018. All rights reserved.