Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
4 changed files
with
307 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package azure | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestGroupMetricsDefinitionsByResourceId(t *testing.T) { | ||
|
||
t.Run("Group metrics definitions by resource ID", func(t *testing.T) { | ||
metrics := []Metric{ | ||
{ | ||
ResourceId: "test", | ||
Namespace: "test", | ||
Names: []string{"name1"}, | ||
}, | ||
{ | ||
ResourceId: "test", | ||
Namespace: "test", | ||
Names: []string{"name2"}, | ||
}, | ||
{ | ||
ResourceId: "test", | ||
Namespace: "test", | ||
Names: []string{"name3"}, | ||
}, | ||
} | ||
|
||
metricsByResourceId := groupMetricsDefinitionsByResourceId(metrics) | ||
|
||
assert.Equal(t, 1, len(metricsByResourceId)) | ||
assert.Equal(t, 3, len(metricsByResourceId["test"])) | ||
}) | ||
} |
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
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