-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Support the duration formatter #153378
Comments
Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations) |
@harnish-elastic can you share with us your configuration in TSVB? Which metric are you using? Do you use a custom formatter? |
@drewdaemon why the suffix/decimals settings are not available in the new metric? |
@stratoula Please find the configuration in TSVB. Yes in the TSVB it is using custom formatter which lens doesn't have support. Let me know if you need anything else. Thanks! Metrics configuration |
Got it thanx! I will add this as an enhancement and discuss it with the team |
We allow the standard
|
@drewdaemon I see, but if someone wants to do something like the above then he cant |
Why not format the field as a time field using the formatter in the data view and then you have it in Lens, Discover and everywhere always correctly calculated. |
|
@stratoula I think Kibana should be capable of discovering that this is a |
Solve it with adding the duration formatter in Lens |
Thank you for the solution. We have tried that solution and it works! However, we strongly need this feature into lens chart because we don't want this manual efforts from the user. If the new user comes there is always manual efforts. |
Security team is using formulas to map this currently. Example: |
As per my perspective, if the visualization need only |
Can we consider this closed by #158468 ? |
@dej611 I think the idea here is to add a custom formatter in Lens for the cases that you don't want to use a dataview field formatter as it applied everywhere |
@dej611 we would like something more powerful as TSVB has where you can specify the from to parameters |
## Summary Fixes #153378 This PR introduces a new Duration formatter, similar to the TSVB one and more complete like the Field Formatter one. Few keys features of the new formatter: * supports from and to unit selection * supports Humanize (approximate) and Humanize (precise) outputs * supports units below milliseconds * supports decimals precision (with the exception of the `humanize approximate` output) * supports suffix * supports the compact version (with the exception of the `humanize approximate` output) Input and Output options are now exported directly from the Field Formatter to have a shared list of options. A first look at the new formatter in action: when enabled it the first time it will lands on `Seconds => Humanize (Approximate)` configuration (this emulates the current Field Formatter behaviour) <img width="1217" alt="Screenshot 2023-07-19 at 15 28 52" src="https://github.com/elastic/kibana/assets/924948/8ddcb945-3cd7-4af1-bdfb-2ae1795ab06c"> In this example the input was in Minutes so it is possible to change it from the default `Seconds` entry: <img width="1223" alt="Screenshot 2023-07-19 at 14 17 11" src="https://github.com/elastic/kibana/assets/924948/b547b3ed-475e-421c-b196-a76b07235bd3"> Switching output type to something else than `Humanize (approximate)` will make available both decimals and compact controls as well. Custom suffix is supported as well. <img width="1220" alt="Screenshot 2023-07-19 at 14 18 34" src="https://github.com/elastic/kibana/assets/924948/f5efe1f7-5f0d-4de1-bb3e-80ff00857bc6"> <img width="1228" alt="Screenshot 2023-07-19 at 14 18 19" src="https://github.com/elastic/kibana/assets/924948/fef7fa2d-ecd3-48ae-a833-16dbeaeaade2"> When Decimals and Compact controls are disabled a helpful tooltip is shown to the user to explain why: <img width="341" alt="Screenshot 2023-07-19 at 14 17 30" src="https://github.com/elastic/kibana/assets/924948/78ca1df5-808d-4e2d-8598-90e3f3ec5a85"> <img width="337" alt="Screenshot 2023-07-19 at 14 17 23" src="https://github.com/elastic/kibana/assets/924948/4ca0028d-3344-464c-8b36-1f74f53bd34e"> I've also prepared an alternate UI version which is more compact, using the `DelimitedControls` UI, but it does not looks that great. Maybe some design iteration could help make it better? cc @MichaelMarcialis <img width="1226" alt="Screenshot 2023-07-19 at 14 20 02" src="https://github.com/elastic/kibana/assets/924948/fb8f69f2-5182-480d-9cb2-7a7149a54320"> ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### 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: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
## Summary Fixes elastic#153378 This PR introduces a new Duration formatter, similar to the TSVB one and more complete like the Field Formatter one. Few keys features of the new formatter: * supports from and to unit selection * supports Humanize (approximate) and Humanize (precise) outputs * supports units below milliseconds * supports decimals precision (with the exception of the `humanize approximate` output) * supports suffix * supports the compact version (with the exception of the `humanize approximate` output) Input and Output options are now exported directly from the Field Formatter to have a shared list of options. A first look at the new formatter in action: when enabled it the first time it will lands on `Seconds => Humanize (Approximate)` configuration (this emulates the current Field Formatter behaviour) <img width="1217" alt="Screenshot 2023-07-19 at 15 28 52" src="https://github.com/elastic/kibana/assets/924948/8ddcb945-3cd7-4af1-bdfb-2ae1795ab06c"> In this example the input was in Minutes so it is possible to change it from the default `Seconds` entry: <img width="1223" alt="Screenshot 2023-07-19 at 14 17 11" src="https://github.com/elastic/kibana/assets/924948/b547b3ed-475e-421c-b196-a76b07235bd3"> Switching output type to something else than `Humanize (approximate)` will make available both decimals and compact controls as well. Custom suffix is supported as well. <img width="1220" alt="Screenshot 2023-07-19 at 14 18 34" src="https://github.com/elastic/kibana/assets/924948/f5efe1f7-5f0d-4de1-bb3e-80ff00857bc6"> <img width="1228" alt="Screenshot 2023-07-19 at 14 18 19" src="https://github.com/elastic/kibana/assets/924948/fef7fa2d-ecd3-48ae-a833-16dbeaeaade2"> When Decimals and Compact controls are disabled a helpful tooltip is shown to the user to explain why: <img width="341" alt="Screenshot 2023-07-19 at 14 17 30" src="https://github.com/elastic/kibana/assets/924948/78ca1df5-808d-4e2d-8598-90e3f3ec5a85"> <img width="337" alt="Screenshot 2023-07-19 at 14 17 23" src="https://github.com/elastic/kibana/assets/924948/4ca0028d-3344-464c-8b36-1f74f53bd34e"> I've also prepared an alternate UI version which is more compact, using the `DelimitedControls` UI, but it does not looks that great. Maybe some design iteration could help make it better? cc @MichaelMarcialis <img width="1226" alt="Screenshot 2023-07-19 at 14 20 02" src="https://github.com/elastic/kibana/assets/924948/fb8f69f2-5182-480d-9cb2-7a7149a54320"> ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### 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: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Kibana version: 8.6.0
Elasticsearch version: 8.6.0
Describe the bug:
While migrating visualizations to lens charts, found that lens doesn't have support of convert value to hours/human-readable format which TSVB visualizations have.
In the below screenshot, user can easily see the value into hours.
While migrating TSVB visualizations to Lens, not able to convert into human-readable format. Please refer the below screenshot
The text was updated successfully, but these errors were encountered: