-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Improve Metric formatter to support bit format #153389
Conversation
Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations) |
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.
Awesome work. I'm happy to see that this change will lead to better format support and consistency with other parts of Kibana. (code review only, lmk if you want me to spin it up)
(serializedFieldFormat?.id === 'suffix' | ||
? serializedFieldFormat.params?.id | ||
: serializedFieldFormat?.id) ?? 'number'; | ||
const formatId = getFormatId(serializedFieldFormat) || 'number'; |
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.
nit: I'd probably move the number
default into getFormatId
.
FWIW, I'm wondering if this is an opportunity to reconsider this decision and add a bits field formatter after all. Added an agenda item to the weekly. |
I think it can be addressed separately as it will affect all visualization types, not just metric. |
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Yes let's discuss it as a separate issue. We should still merge this PR as it is a very good enhancement |
Summary
Fixes #152014
This PR switches the formatter in the Metric visualization type from the
Intl.NumberFormat
back to thenumeral.js
one which supports more units for thebytes
andbit
format types.While fixing the referenced issue, this PR also introduced some changes in how the
bytes
number format is displayed to the user, mainly:1024
threshold, theB
format is used instead of the full wordbytes
-- see thek
for kilo is not capitalized when usingbytes
as documented for binary values for the entire Kibana project -- see theK
for kilo is capitalized when usingbytes
as documented documented for binary values for the entire Kibana projectComparison table
Checklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers