lib/streamaggr: add tests for keep_metric_names and drop_input_labels options

This commit is contained in:
Aliaksandr Valialkin 2024-03-06 18:34:04 +02:00
parent 96f913c83e
commit 5582a24ecf
No known key found for this signature in database
GPG Key ID: 52C003EE2BCDB9EB

View File

@ -828,6 +828,39 @@ foo-1m-without-abc-count-samples{new_label="must_keep_metric_name"} 2
foo-1m-without-abc-count-series{new_label="must_keep_metric_name"} 1 foo-1m-without-abc-count-series{new_label="must_keep_metric_name"} 1
foo-1m-without-abc-sum-samples{new_label="must_keep_metric_name"} 12.5 foo-1m-without-abc-sum-samples{new_label="must_keep_metric_name"} 12.5
`, "1111") `, "1111")
// keep_metric_names
f(`
- interval: 1m
keep_metric_names: true
outputs: [count_samples]
`, `
foo{abc="123"} 4
bar 5
foo{abc="123"} 8.5
bar -34.3
foo{abc="456",de="fg"} 8
`, `bar 2
foo{abc="123"} 2
foo{abc="456",de="fg"} 1
`, "11111")
// drop_input_labels
f(`
- interval: 1m
drop_input_labels: [abc]
keep_metric_names: true
outputs: [count_samples]
`, `
foo{abc="123"} 4
bar 5
foo{abc="123"} 8.5
bar -34.3
foo{abc="456",de="fg"} 8
`, `bar 2
foo 2
foo{de="fg"} 1
`, "11111")
} }
func TestAggregatorsWithDedupInterval(t *testing.T) { func TestAggregatorsWithDedupInterval(t *testing.T) {