Class MetricCollectionAggregator
- java.lang.Object
-
- software.amazon.awssdk.metrics.publishers.cloudwatch.internal.transform.MetricCollectionAggregator
-
@NotThreadSafe public class MetricCollectionAggregator extends Object
AggregatesMetricCollections 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 ofPutMetricDataRequests.It would be too expensive to upload every
MetricCollectionas a uniquePutMetricDataRequest, so this class aggregates the data so that multipleMetricCollections can be placed in the samePutMetricDataRequest.Warning: This class is *not* thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_METRIC_DATA_PER_REQUESTThe maximum number ofMetricDatums allowed inPutMetricDataRequest.metricData().static intMAX_VALUES_PER_REQUESTThe maximum number of uniqueMetricDatum.values()allowed in a singlePutMetricDataRequest.
-
Constructor Summary
Constructors Constructor Description MetricCollectionAggregator(String namespace, Set<SdkMetric<String>> dimensions, Set<MetricCategory> metricCategories, MetricLevel metricLevel, Set<SdkMetric<?>> detailedMetrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCollection(MetricCollection collection)Add a collection to this aggregator.List<PutMetricDataRequest>getRequests()Get allPutMetricDataRequests that can be generated from the data that was added viaaddCollection(MetricCollection).
-
-
-
Field Detail
-
MAX_METRIC_DATA_PER_REQUEST
public static final int MAX_METRIC_DATA_PER_REQUEST
The maximum number ofMetricDatums allowed inPutMetricDataRequest.metricData(). This limit is imposed by CloudWatch.- See Also:
- Constant Field Values
-
MAX_VALUES_PER_REQUEST
public static final int MAX_VALUES_PER_REQUEST
The 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:
- Constant Field Values
-
-
Constructor Detail
-
MetricCollectionAggregator
public MetricCollectionAggregator(String namespace, Set<SdkMetric<String>> dimensions, Set<MetricCategory> metricCategories, MetricLevel metricLevel, Set<SdkMetric<?>> detailedMetrics)
-
-
Method Detail
-
addCollection
public void addCollection(MetricCollection collection)
Add a collection to this aggregator.
-
getRequests
public List<PutMetricDataRequest> getRequests()
Get allPutMetricDataRequests that can be generated from the data that was added viaaddCollection(MetricCollection). This method resets the state of thisMetricCollectionAggregator.
-
-