File tree 2 files changed +7
-1
lines changed
x-pack/metricbeat/module/azure
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ func metricIsEmpty(metric armmonitor.MetricValue) bool {
92
92
// matchMetrics will compare current metrics
93
93
func matchMetrics (prevMet Metric , met Metric ) bool {
94
94
if prevMet .Namespace == met .Namespace && reflect .DeepEqual (prevMet .Names , met .Names ) && prevMet .ResourceId == met .ResourceId &&
95
- prevMet .Aggregations == met .Aggregations && prevMet .TimeGrain == met .TimeGrain {
95
+ prevMet .Aggregations == met .Aggregations && prevMet .TimeGrain == met .TimeGrain && reflect . DeepEqual ( prevMet . Dimensions , met . Dimensions ) {
96
96
return true
97
97
}
98
98
return false
Original file line number Diff line number Diff line change @@ -77,11 +77,17 @@ func TestMatchMetrics(t *testing.T) {
77
77
Values : []MetricValue {},
78
78
TimeGrain : "1PM" ,
79
79
}
80
+ // match
80
81
result := matchMetrics (prev , current )
81
82
assert .True (t , result )
83
+ // different resourceId, not match
82
84
current .ResourceId = "id1"
83
85
result = matchMetrics (prev , current )
84
86
assert .False (t , result )
87
+ // different dimension, not match
88
+ current .Dimensions = []Dimension {{Name : "location" , Value : "East Europe" }}
89
+ result = matchMetrics (prev , current )
90
+ assert .False (t , result )
85
91
}
86
92
87
93
func TestMetricIsEmpty (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments