Class MetricCollectionAggregator
java.lang.Object
software.amazon.awssdk.metrics.publishers.cloudwatch.internal.transform.MetricCollectionAggregator
Aggregates
MetricCollections 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 PutMetricDataRequests.
It would be too expensive to upload every MetricCollection as a unique PutMetricDataRequest, so this
class aggregates the data so that multiple MetricCollections can be placed in the same PutMetricDataRequest.
Warning: This class is *not* thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum number ofMetricDatums allowed inPutMetricDataRequest.metricData().static final intThe maximum number of uniqueMetricDatum.values()allowed in a singlePutMetricDataRequest. -
Constructor Summary
ConstructorsConstructorDescriptionMetricCollectionAggregator(String namespace, Set<SdkMetric<String>> dimensions, Set<MetricCategory> metricCategories, MetricLevel metricLevel, Set<SdkMetric<?>> detailedMetrics) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCollection(MetricCollection collection) Add a collection to this aggregator.Get allPutMetricDataRequests 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 ofMetricDatums 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 allPutMetricDataRequests that can be generated from the data that was added viaaddCollection(MetricCollection). This method resets the state of thisMetricCollectionAggregator.
-