-
-
Notifications
You must be signed in to change notification settings - Fork 535
fix(yabeda): Normalize plural Yabeda units to Sentry's singular form #2953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,11 +68,8 @@ def metric_name(metric) | |
| [metric.group, metric.name].compact.join(".") | ||
| end | ||
|
|
||
| # TODO: Normalize Yabeda unit symbols (e.g. :milliseconds) to Sentry's | ||
| # canonical singular strings (e.g. "millisecond") once units are visible | ||
| # in the Sentry product. See https://develop.sentry.dev/sdk/foundations/state-management/scopes/attributes/#units | ||
| def unit_for(metric) | ||
| metric.unit&.to_s | ||
| metric.unit&.to_s&.chomp("s") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Naive
|
||
| end | ||
| end | ||
| end | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The use of
chomp("s")to handle pluralization will incorrectly truncate any custom unit that naturally ends in "s", like:process.Severity: MEDIUM
Suggested Fix
Instead of unconditionally calling
chomp("s"), use a more robust method for singularization, such as a dedicated inflection library. Alternatively, if only handling standard units, use a targeted replacement based on a known list of plural forms rather than a blanket string manipulation.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's right but ok in our case, as we do have a fixed set of units for now imho