Class MetricCollectionAggregator
java.lang.Object
software.amazon.awssdk.metrics.publishers.cloudwatch.internal.transform.MetricCollectionAggregator
Aggregates
MetricCollection
s by: (1) the minute in which they occurred, and (2) the dimensions in the collection
associated with that metric. Allows retrieving the aggregated values as a list of PutMetricDataRequest
s.
It would be too expensive to upload every MetricCollection
as a unique PutMetricDataRequest
, so this
class aggregates the data so that multiple MetricCollection
s can be placed in the same PutMetricDataRequest
.
Warning: This class is *not* thread-safe.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum number ofMetricDatum
s allowed inPutMetricDataRequest.metricData()
.static final int
The maximum number of uniqueMetricDatum.values()
allowed in a singlePutMetricDataRequest
. -
Constructor Summary
ConstructorDescriptionMetricCollectionAggregator
(String namespace, Set<SdkMetric<String>> dimensions, Set<MetricCategory> metricCategories, MetricLevel metricLevel, Set<SdkMetric<?>> detailedMetrics) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCollection
(MetricCollection collection) Add a collection to this aggregator.Get allPutMetricDataRequest
s that can be generated from the data that was added viaaddCollection(MetricCollection)
.
-
Field Details
-
MAX_METRIC_DATA_PER_REQUEST
public static final int MAX_METRIC_DATA_PER_REQUESTThe maximum number ofMetricDatum
s allowed inPutMetricDataRequest.metricData()
. This limit is imposed by CloudWatch.- See Also:
-
MAX_VALUES_PER_REQUEST
public static final int MAX_VALUES_PER_REQUESTThe maximum number of uniqueMetricDatum.values()
allowed in a singlePutMetricDataRequest
. This limit is not imposed directly by CloudWatch, but they do impose a 40KB limit for a single request. This value was determined by trial-and-error to roughly equate to a 40KB limit when we are also at theMAX_METRIC_DATA_PER_REQUEST
.- See Also:
-
-
Constructor Details
-
MetricCollectionAggregator
public MetricCollectionAggregator(String namespace, Set<SdkMetric<String>> dimensions, Set<MetricCategory> metricCategories, MetricLevel metricLevel, Set<SdkMetric<?>> detailedMetrics)
-
-
Method Details
-
addCollection
Add a collection to this aggregator. -
getRequests
Get allPutMetricDataRequest
s that can be generated from the data that was added viaaddCollection(MetricCollection)
. This method resets the state of thisMetricCollectionAggregator
.
-