[8.13](backport #39204) Fix Azure Monitor support for multiple aggregation types #39279
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.
Proposed commit message
Fixes two bugs related to supporting multiple aggregation types.
MetricRegistry
in the cache key.KeyValuePoint
for each aggregation type(1) Use aggregation type in
MetricRegistry
in the cache keyThe
MetricRegistry.NeedsUpdate
checks if a metric definition needs an update. If there are multiple metrics config with no dimensions:All three metric configs end up having the same key, ending up skipping the metric collection for the second and third configs.
By adding the aggregation type in the cache key, we can correctly keep track of metric updates.
(2) Create one
KeyValuePoint
for each aggregation typeAdd support for multiple aggregation types in the
mapToKeyValuePoints()
function to restore support for configs like the following:I missed this feature in a previous change. Unfortunately, no existing modules or integrations use multiple aggregation types, and no tests exist.
We are adding more tests targeting to cover all existing use cases soon.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
The PR must support multiple aggregation types in two different variants:
Here are two variants of the metric
ActiveConnections
with three aggregation types:Maximum
,Minimum
, andAvergate
:This variant should be preferred since in needs less API calls to fetch the same data:
Screenshots
Logs
This is an automatic backport of pull request #39204 done by [Mergify](https://mergify.com).