Add deltatocumulativeprocessor for AMP destinations #1624
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the issue
Currently, the CloudWatch Agent uses the prometheusremotewrite exporter to send metrics to Amazon Managed Prometheus. It does not support delta metrics so the metrics are dropped:
This issue was discovered while updating the AMP integration test: aws/amazon-cloudwatch-agent-test#465 (comment)
Description of changes
To remediate, the agent will use deltatocumulativeprocessor in AMP destination pipelines to convert delta metrics to cumulative metrics before being processed by the exporter.
The processor has two settings:
max_stale
: how long until a series not receiving new samples is removedmax_streams
: upper limit of streams to track. new streams exceeding this limit will be droppedThe
max_stale
setting defaults to 5m which may not be ideal for all users. If users emit hourly delta metrics, for example, then the ingested datapoints will always start a new stream. Thecumulativetodeltaprocessor
is very similar processor which has a similar setting. By default, the processor uses infinite staleness so metric streams will never be dropped. Ideally, we'd configure the deltatocumulativeprocessor in the same manner the be consistent, but infinite staleness is not an option for the deltatocumulativeprocessor. Instead, we'll follow AWS's PutMetricData API convention of supporting metrics up two weeks:The
max_streams
setting defaults to 64-bit integer maximum (9223372036854775807) which is effectively infinite. This is consistent with the cumulativetodeltaprocessor which uses an unbounded map to keep track of metrics.See related integration test update: aws/amazon-cloudwatch-agent-test#494
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
Ran the AMP integration test with agent updates and then locate delta metrics in AMG:

Updated AMP integration test to check for delta counter and delta histogram metrics now that they are supported.
Requirements
Before commit the code, please do the following steps.
make fmt
andmake fmt-sh
make lint