-
Notifications
You must be signed in to change notification settings - Fork 483
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
Fix rendering X axis in TraceResultsScatterPlot - pass milliseconds to moment.js #274
Conversation
Signed-off-by: Ivan Strelkov <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #274 +/- ##
==========================================
+ Coverage 77.08% 77.15% +0.06%
==========================================
Files 135 135
Lines 2955 2955
Branches 613 613
==========================================
+ Hits 2278 2280 +2
+ Misses 534 532 -2
Partials 143 143
Continue to review full report at Codecov.
|
<XAxis | ||
title="Time" | ||
tickTotal={4} | ||
tickFormat={t => moment(t / ONE_MILLISECOND).format('hh:mm:ss a')} |
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.
what does the moment() function do?
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.
moment
- is the main function of moment.js framework - https://momentjs.com/
It may accept different inputs (strings, Date objects, timestamps). Here it accepts timestamp (number of milliseconds since 1 January 1970 UTC)
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.
Thanks.
While this may be an OK fix for this specific issue, I think a bigger problem is that we have to do that in the first place. I would expect the UI to have some domain model of the trace and expose the timestamps not in raw microseconds format, but in some structured representation, so that the presentation code wouldn't have to do these conversions all over the place.
Is it possible to add tests? |
I guess, It's possible to add tests. But I have to expose |
Signed-off-by: Ivan Strelkov <[email protected]>
I've added tests. Note: In order to test axis rendering, I've exported |
@yurishkuro Could you please tell me what to do next with this PR? |
Thanks! @tiffon is travelling, should be back later this week, I would like him to review. |
Looks great! Thanks for your contribution! 🎉 |
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.
👍
…o moment.js (jaegertracing#274) * Fix rendering X axis in TraceResultsScatterPlot Signed-off-by: Ivan Strelkov <[email protected]> * Test ScatterPlot axis rendering Signed-off-by: Ivan Strelkov <[email protected]>
…o moment.js (jaegertracing#274) * Fix rendering X axis in TraceResultsScatterPlot Signed-off-by: Ivan Strelkov <[email protected]> * Test ScatterPlot axis rendering Signed-off-by: Ivan Strelkov <[email protected]> Signed-off-by: vvvprabhakar <[email protected]>
Resolves #270
Which problem is this PR solving?
This PR fixes rendering X axis values in TraceResultsScatterPlot.
Short description of the changes
Now it passes milliseconds into moment.js function call. Previously there were milliseconds multiplied by 1000 (i.e. raw timestamp from server)