fix(cli): Deduplicate metric suggestions in ResolutionError#1299
Open
sentry[bot] wants to merge 2 commits into
Open
fix(cli): Deduplicate metric suggestions in ResolutionError#1299sentry[bot] wants to merge 2 commits into
sentry[bot] wants to merge 2 commits into
Conversation
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5493 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.74% 81.75% +0.01%
==========================================
Files 428 428 —
Lines 30106 30105 -1
Branches 19593 19593 —
==========================================
+ Hits 24611 24612 +1
- Misses 5495 5493 -2
- Partials 2054 2054 —Generated by Codecov Action |
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.
The
resolveMetricFieldfunction in the CLI, when a metric is not found, attempts to suggest similar metrics usingfuzzyMatch. ThecandidateNameslist, however, was populated directly from themetricsarray returned by the API, which can contain duplicate entries for the same metric name (e.g., due to different tag combinations).This led to
fuzzyMatchreturning the same metric name multiple times in the suggestions, resulting in confusing error messages like "Similar metrics: metric.name, metric.name, metric.name...".This change wraps the
metrics.map(m => m.name).filter(...)expression with[...new Set(...)]to ensure thatcandidateNamescontains only unique metric names. This prevents duplicate suggestions in theResolutionErrormessage, improving clarity for the user.Fixes CLI-1XK
Comment
@sentry <feedback>on this PR to have Autofix iterate on the changes.