-
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] Add bit formatter #141372
[Lens] Add bit formatter #141372
Conversation
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
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.
@mbondyra good catch, I missed that. Should work now. I didn't correctly look up the actual formatter id in all places. |
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Given the current approach, the metric vis does not add the correct suffix. It treats the values as regular numbers since it takes its cue as to how to format the value based on the field formatter's ID. Have we considered adding a "bits" field formatter? That would allow the metric vis to detect bits values and harness the power of the |
Good call @andrewctate , I thought about it but decided against it as it increases the surface area further (adding a new formatter which, if we follow the existing setup, needs an advanced setting for the default value) and the new metric vis is already rendering almost the same thing as it's doing the kilo, mega, giga abbreviations already (without the "b" suffix, but otherwise it's identical). All of the approaches feel kind of hacky, but if you think the bits formatter would be preferable I can adjust the PR. |
This is where the default pattern is coming from - if we don't want to introduce a new advanced setting, we would need to adjust this logic which I tried to avoid, but maybe it's worth it:
|
Discussed the metric vis synchronously. Decided this is fine as is for now. We can always add the proper suffix later if we decided it's worth the hassle of adding a new advanced setting. |
Fixes #139639
adds a basic bit formatter:
Formats a number as bits using numeral.js . Defaults to 0 decimals but it can be formatted.