public class ReportRequestAggregator
extends java.lang.Object
ReportRequests.
Thread-safe.| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_OPERATION_COUNT
The maximum number of operations to send in a report request.
|
static int |
NON_CACHING
The flush interval returned by
getFlushIntervalMillis() when an instance is
configured to be non-caching. |
| Constructor and Description |
|---|
ReportRequestAggregator(java.lang.String serviceName,
ReportAggregationOptions options)
Constructor.
|
ReportRequestAggregator(java.lang.String serviceName,
ReportAggregationOptions options,
java.util.Map<java.lang.String,com.google.api.MetricDescriptor.MetricKind> kinds)
Constructor.
|
ReportRequestAggregator(java.lang.String serviceName,
ReportAggregationOptions options,
java.util.Map<java.lang.String,com.google.api.MetricDescriptor.MetricKind> kinds,
com.google.common.base.Ticker ticker)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.api.servicecontrol.v1.ReportRequest[] |
clear()
Clears this instances cache of aggregated operations.
|
com.google.api.servicecontrol.v1.ReportRequest[] |
flush()
Flushes this instance's cache.
|
protected com.google.api.servicecontrol.v1.ReportRequest[] |
generatedFlushRequests(java.lang.Iterable<OperationAggregator> aggregators) |
int |
getFlushIntervalMillis() |
java.lang.String |
getServiceName() |
boolean |
report(com.google.api.servicecontrol.v1.ReportRequest req)
Adds a report request to this instance's cache.
|
public static final int NON_CACHING
getFlushIntervalMillis() when an instance is
configured to be non-caching.public static final int MAX_OPERATION_COUNT
public ReportRequestAggregator(java.lang.String serviceName,
ReportAggregationOptions options,
@Nullable
java.util.Map<java.lang.String,com.google.api.MetricDescriptor.MetricKind> kinds,
@Nullable
com.google.common.base.Ticker ticker)
serviceName - the service whose ReportRequests are being aggregatedoptions - configures this instance's caching behaviorkinds - specifies the MetricDescriptor.MetricKind for specific metric namesticker - the time source used to determine expiration. When not specified, this defaults
to Ticker.systemTicker()public ReportRequestAggregator(java.lang.String serviceName,
ReportAggregationOptions options,
@Nullable
java.util.Map<java.lang.String,com.google.api.MetricDescriptor.MetricKind> kinds)
serviceName - the service whose ReportRequests are being aggregatedoptions - configures this instances caching behaviorkinds - specifies the MetricDescriptor.MetricKind for specific metric namespublic ReportRequestAggregator(java.lang.String serviceName,
ReportAggregationOptions options)
serviceName - the service whose ReportRequests are being aggregatedoptions - configures this instances caching behaviorpublic int getFlushIntervalMillis()
flush()public java.lang.String getServiceName()
ReportRequests are being aggregatedpublic com.google.api.servicecontrol.v1.ReportRequest[] clear()
public com.google.api.servicecontrol.v1.ReportRequest[] flush()
getFlushIntervalMillis()
milliseconds, and send the results to the report service.report(com.google.api.servicecontrol.v1.ReportRequest)public boolean report(com.google.api.servicecontrol.v1.ReportRequest req)
req - a ReportRequest to cache in this instance.true if req was cached successfully, otherwise falseprotected com.google.api.servicecontrol.v1.ReportRequest[] generatedFlushRequests(java.lang.Iterable<OperationAggregator> aggregators)