-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release-2.11] Fix .metricsUsed in mimirtool analyze rule-file (#6953) (
#6956) * Fix .metricsUsed in mimirtool analyze rule-file (#6953) * Fix .metricsUsed in mimirtool analyze rule-file This field wasn't populated. Fixes #6952 Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> * Update CHANGELOG.md Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> * make license Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> --------- Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> (cherry picked from commit 6a7bee2) Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> * Update release notes Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> --------- Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 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
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,43 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
package commands | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/prometheus/common/model" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestAnalyzeRuleFiles(t *testing.T) { | ||
mir, err := AnalyzeRuleFiles([]string{"testdata/prometheus_rules.yaml"}) | ||
require.NoError(t, err) | ||
require.Equal(t, 24, len(mir.MetricsUsed)) | ||
expectedMetrics := model.LabelValues{ | ||
"apiserver_request_duration_seconds_bucket", | ||
"apiserver_request_duration_seconds_count", | ||
"apiserver_request_total", | ||
"container_memory_cache", | ||
"container_memory_rss", | ||
"container_memory_swap", | ||
"container_memory_working_set_bytes", | ||
"kube_pod_container_resource_limits", | ||
"kube_pod_container_resource_requests", | ||
"kube_pod_info", | ||
"kube_pod_owner", | ||
"kube_pod_status_phase", | ||
"kube_replicaset_owner", | ||
"kubelet_node_name", | ||
"kubelet_pleg_relist_duration_seconds_bucket", | ||
"node_cpu_seconds_total", | ||
"node_memory_Buffers_bytes", | ||
"node_memory_Cached_bytes", | ||
"node_memory_MemAvailable_bytes", | ||
"node_memory_MemFree_bytes", | ||
"node_memory_Slab_bytes", | ||
"scheduler_binding_duration_seconds_bucket", | ||
"scheduler_e2e_scheduling_duration_seconds_bucket", | ||
"scheduler_scheduling_algorithm_duration_seconds_bucket", | ||
} | ||
require.Equal(t, expectedMetrics, mir.MetricsUsed) | ||
} |