Skip to content

[AGTMETRICS-347]Add tag cardinality option#213

Merged
StephenWakely merged 5 commits intomasterfrom
stephen/tag_cardinality
Aug 14, 2025
Merged

[AGTMETRICS-347]Add tag cardinality option#213
StephenWakely merged 5 commits intomasterfrom
stephen/tag_cardinality

Conversation

@StephenWakely
Copy link
Copy Markdown
Contributor

This adds the tag cardinality option. A global setting can be applied via the config options. It can be overriden per metric if needed.

@StephenWakely StephenWakely requested a review from a team as a code owner August 12, 2025 13:11
Comment on lines +102 to +109
output.Contains("requests:3|c") && (output.Contains("#card:low") || output.Contains("env:prod")),
"Expected Low cardinality metric with env:prod tag and value 3");
Assert.True(
output.Contains("requests:3|c") && (output.Contains("#card:low") || output.Contains("env:staging")),
"Expected Low cardinality metric with env:staging tag and value 3");
Assert.True(
output.Contains("requests:4|c") && (output.Contains("#card:high") || output.Contains("env:prod")),
"Expected High cardinality metric with env:prod tag and value 4");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  • I think you meant to do |card instead of #card?
  • These piecemeal checks don't properly assert which metric has which cardinality/tags. We should just be checking for the full metric strings that we expect.

Comment on lines +40 to +42
Assert.True(output.Contains("cpu_usage:20|g") && output.Contains("card:low"), "Expected Low cardinality gauge with value 20.0");
Assert.True(output.Contains("cpu_usage:30|g") && output.Contains("card:high"), "Expected High cardinality gauge with value 30.0");
Assert.True(output.Contains("cpu_usage:40|g") && !output.Contains("cpu_usage:40|g|card:"), "Expected null cardinality gauge with value 40.0");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above about piecemeal checks that don't properly assert which metric has which cardinality/tags.

Comment on lines +61 to +69
Assert.True(
output.Contains("memory:200|g") && (output.Contains("card:low") || output.Contains("host:server1")),
"Expected Low cardinality gauge with host:server1 and value 200.0");
Assert.True(
output.Contains("memory:150|g") && (output.Contains("card:low") || output.Contains("host:server2")),
"Expected Low cardinality gauge with host:server2 and value 150.0");
Assert.True(
output.Contains("memory:300|g") && (output.Contains("card:high") || output.Contains("host:server1")),
"Expected High cardinality gauge with host:server1 and value 300.0");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above about piecemeal checks that don't properly assert which metric has which cardinality/tags.

@StephenWakely StephenWakely requested a review from tobz August 14, 2025 10:26
@StephenWakely StephenWakely merged commit 6dc20f4 into master Aug 14, 2025
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants