-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.13](backport #39204) Fix Azure Monitor support for multiple aggreg…
…ation types (#39279) * Fix Azure Monitor support for multiple aggregation types (#39204) * Add aggregation type to the MetricRegistry key The MetricRegistry wasn't using the aggregation type in the cache key, returning the wrong answer to the 'needs update?' question. * Handle multiple aggregation types Restores support for multiple aggregation types for the same metric name. Adding tests for the known use cases so we don't miss this feature again in future updates. (cherry picked from commit 81fc73e) * Remove extra changelog entries --------- Co-authored-by: Maurizio Branca <maurizio.branca@elastic.co>
- Loading branch information
1 parent
a348f20
commit af2ac6d
Showing
9 changed files
with
527 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package azure | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGroupMetricsDefinitionsByResourceId(t *testing.T) { | ||
|
||
t.Run("Group metrics definitions by resource ID", func(t *testing.T) { | ||
metrics := []Metric{ | ||
{ | ||
ResourceId: "resource-1", | ||
Namespace: "namespace-1", | ||
Names: []string{"metric-1"}, | ||
}, | ||
{ | ||
ResourceId: "resource-1", | ||
Namespace: "namespace-1", | ||
Names: []string{"metric-2"}, | ||
}, | ||
{ | ||
ResourceId: "resource-1", | ||
Namespace: "namespace-1", | ||
Names: []string{"metric-3"}, | ||
}, | ||
} | ||
|
||
metricsByResourceId := groupMetricsDefinitionsByResourceId(metrics) | ||
|
||
assert.Equal(t, 1, len(metricsByResourceId)) | ||
assert.Equal(t, 3, len(metricsByResourceId["resource-1"])) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.