[AGTMETRICS-347]Add tag cardinality option#213
Merged
StephenWakely merged 5 commits intomasterfrom Aug 14, 2025
Merged
Conversation
tobz
suggested changes
Aug 13, 2025
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"); |
Member
There was a problem hiding this comment.
Two things:
- I think you meant to do
|cardinstead 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"); |
Member
There was a problem hiding this comment.
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"); |
Member
There was a problem hiding this comment.
Same comment as above about piecemeal checks that don't properly assert which metric has which cardinality/tags.
tobz
approved these changes
Aug 14, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the tag cardinality option. A global setting can be applied via the config options. It can be overriden per metric if needed.