Skip to content
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

[ML] APM Latency Correlations: Fix formatting of duration values for log x axis and selection badge. #109214

Merged
merged 7 commits into from
Aug 20, 2021

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Aug 19, 2021

Summary

Follow up to #108211.
Part of #106381.

  • Fix, clean up and unit tests for the log log charts x axis duration based ticks. This extends existing duration utilities to support a custom threshold to be able to fine tune the formatting for either single values with more detail or chart axis ticks where less detail is required. This is useful for log axis that cover a wider range of units. As can be seen in the screenshot, axis ticks will be formatted as full seconds from 1s onwards instead of 1,000 ms already up to 10 seconds. Because the threshold parameter is optional and defaults to 10, other uses of getDurationFormatter don't need to be changed.

image

  • Fixes the formatting of the selection badge.

Checklist

@walterra walterra added bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support :ml v8.0.0 release_note:skip Skip the PR/issue when compiling release notes apm:correlations v7.15.0 labels Aug 19, 2021
@walterra walterra self-assigned this Aug 19, 2021
@walterra walterra marked this pull request as ready for review August 19, 2021 10:18
@walterra walterra requested a review from a team as a code owner August 19, 2021 10:18
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra walterra changed the title [ML] APM Latency Correlations: Fix formatting of axis ticks. [ML] APM Latency Correlations: Fix formatting of duration values for log x axis and selection badge. Aug 19, 2021
@formgeist
Copy link
Contributor

Super small nit; I noticed that the chart x-axis label unit is without a space between the number and unit. I personally find it easier to read when there's a space between the value and unit.

130051517-dae02938-b9ab-421c-8c78-c0e8eb0be686

Compared to e.g. our chart legends

CleanShot 2021-08-19 at 12 57 14@2x

Copy link
Contributor

@formgeist formgeist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I like that we're doing this for the logarithmic scale 👍

@walterra
Copy link
Contributor Author

@formgeist I'll add the space between value and unit for consistency, will also make the code a bit simpler.

unitKey: DurationTimeUnit,
value: number
value: number,
threshold: number = 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super duper nit: I think it would be good to have a comment on what's the purpose of threshold, as it's not obvious at first glance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 03fadfe.

@@ -46,7 +47,8 @@ export function getUnitLabelAndConvertedValue(
defaultMessage: 'h',
}),
convertedValue: asDecimalOrInteger(
moment.duration(value / 1000).asHours()
moment.duration(value / 1000).asHours(),
Copy link
Member

@sorenlouv sorenlouv Aug 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you didn't touch this but:

nit: Can you extract this calculation and re-use it for all units, to make it obvious that we are converting from milliseconds

const ms = value / 1000
Suggested change
moment.duration(value / 1000).asHours(),
moment.duration(ms).asHours(),

@walterra walterra added auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 labels Aug 20, 2021
@walterra walterra enabled auto-merge (squash) August 20, 2021 07:53
@walterra
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 4.4MB 4.4MB -543.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @walterra

@walterra walterra merged commit ca6bb4b into elastic:master Aug 20, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 20, 2021
…log x axis and selection badge. (elastic#109214)

- Fix, clean up and unit tests for the log log charts x axis duration based ticks. This extends existing duration utilities to support a custom threshold to be able to fine tune the formatting for either single values with more detail or chart axis ticks where less detail is required. This is useful for log axis that cover a wider range of units. As can be seen in the screenshot, axis ticks will be formatted as full seconds from 1s onwards instead of 1,000 ms already up to 10 seconds. Because the threshold parameter is optional and defaults to 10, other uses of getDurationFormatter don't need to be changed.
- Fixes the formatting of the selection badge.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 20, 2021
…log x axis and selection badge. (elastic#109214)

- Fix, clean up and unit tests for the log log charts x axis duration based ticks. This extends existing duration utilities to support a custom threshold to be able to fine tune the formatting for either single values with more detail or chart axis ticks where less detail is required. This is useful for log axis that cover a wider range of units. As can be seen in the screenshot, axis ticks will be formatted as full seconds from 1s onwards instead of 1,000 ms already up to 10 seconds. Because the threshold parameter is optional and defaults to 10, other uses of getDurationFormatter don't need to be changed.
- Fixes the formatting of the selection badge.
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.15
7.x

The backport PRs will be merged automatically after passing CI.

@walterra walterra deleted the ml-apm-distribution-chart-axis-fix branch August 20, 2021 11:06
kibanamachine added a commit that referenced this pull request Aug 20, 2021
…log x axis and selection badge. (#109214) (#109416)

- Fix, clean up and unit tests for the log log charts x axis duration based ticks. This extends existing duration utilities to support a custom threshold to be able to fine tune the formatting for either single values with more detail or chart axis ticks where less detail is required. This is useful for log axis that cover a wider range of units. As can be seen in the screenshot, axis ticks will be formatted as full seconds from 1s onwards instead of 1,000 ms already up to 10 seconds. Because the threshold parameter is optional and defaults to 10, other uses of getDurationFormatter don't need to be changed.
- Fixes the formatting of the selection badge.

Co-authored-by: Walter Rafelsberger <walter@elastic.co>
kibanamachine added a commit that referenced this pull request Aug 20, 2021
…log x axis and selection badge. (#109214) (#109415)

- Fix, clean up and unit tests for the log log charts x axis duration based ticks. This extends existing duration utilities to support a custom threshold to be able to fine tune the formatting for either single values with more detail or chart axis ticks where less detail is required. This is useful for log axis that cover a wider range of units. As can be seen in the screenshot, axis ticks will be formatted as full seconds from 1s onwards instead of 1,000 ms already up to 10 seconds. Because the threshold parameter is optional and defaults to 10, other uses of getDurationFormatter don't need to be changed.
- Fixes the formatting of the selection badge.

Co-authored-by: Walter Rafelsberger <walter@elastic.co>
@walterra walterra mentioned this pull request Aug 24, 2021
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:correlations auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience :ml release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support v7.15.0 v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants