-
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
[ML] APM Latency Correlations: Fix formatting of duration values for log x axis and selection badge. #109214
[ML] APM Latency Correlations: Fix formatting of duration values for log x axis and selection badge. #109214
Conversation
Pinging @elastic/apm-ui (Team:apm) |
Pinging @elastic/ml-ui (:ml) |
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.
LGTM - I like that we're doing this for the logarithmic scale 👍
@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 |
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.
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.
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.
Added in 03fadfe.
@@ -46,7 +47,8 @@ export function getUnitLabelAndConvertedValue( | |||
defaultMessage: 'h', | |||
}), | |||
convertedValue: asDecimalOrInteger( | |||
moment.duration(value / 1000).asHours() | |||
moment.duration(value / 1000).asHours(), |
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.
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
moment.duration(value / 1000).asHours(), | |
moment.duration(ms).asHours(), |
x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx
Show resolved
Hide resolved
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @walterra |
…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.
…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.
…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>
…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>
Summary
Follow up to #108211.
Part of #106381.
1s
onwards instead of1,000 ms
already up to 10 seconds. Because thethreshold
parameter is optional and defaults to10
, other uses ofgetDurationFormatter
don't need to be changed.Checklist