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

Fix rendering X axis in TraceResultsScatterPlot - pass milliseconds to moment.js #274

Merged
merged 2 commits into from Nov 18, 2018

Conversation

Projects
None yet
3 participants
@istrel
Copy link
Contributor

commented Nov 13, 2018

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)

Fix rendering X axis in TraceResultsScatterPlot
Signed-off-by: Ivan Strelkov <iv-strelkov@yandex.ru>
@codecov

This comment has been minimized.

Copy link

commented Nov 13, 2018

Codecov Report

Merging #274 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...nents/SearchTracePage/SearchResults/ScatterPlot.js 72.72% <100%> (+36.36%) ⬆️
...neViewer/TimelineHeaderRow/TimelineViewingLayer.js 87.03% <0%> (-3.71%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update feeaccd...78929b0. Read the comment docs.

<XAxis
title="Time"
tickTotal={4}
tickFormat={t => moment(t / ONE_MILLISECOND).format('hh:mm:ss a')}

This comment has been minimized.

Copy link
@yurishkuro

yurishkuro Nov 13, 2018

Member

what does the moment() function do?

This comment has been minimized.

Copy link
@istrel

istrel Nov 13, 2018

Author Contributor

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)

This comment has been minimized.

Copy link
@yurishkuro

yurishkuro Nov 13, 2018

Member

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.

@yurishkuro

This comment has been minimized.

Copy link
Member

commented Nov 13, 2018

Is it possible to add tests?

@istrel

This comment has been minimized.

Copy link
Contributor Author

commented Nov 13, 2018

I guess, It's possible to add tests.

But I have to expose ScatterPlotImpl only for testing purposes to do so.

Test ScatterPlot axis rendering
Signed-off-by: Ivan Strelkov <iv-strelkov@yandex.ru>
@istrel

This comment has been minimized.

Copy link
Contributor Author

commented Nov 14, 2018

I've added tests.

Note: In order to test axis rendering, I've exported ScatterPlotImpl.

@istrel

This comment has been minimized.

Copy link
Contributor Author

commented Nov 14, 2018

@yurishkuro Could you please tell me what to do next with this PR?

@yurishkuro

This comment has been minimized.

Copy link
Member

commented Nov 14, 2018

Thanks!

@tiffon is travelling, should be back later this week, I would like him to review.

@tiffon

This comment has been minimized.

Copy link
Member

commented Nov 18, 2018

Looks great! Thanks for your contribution! 🎉

@tiffon
Copy link
Member

left a comment

👍

@tiffon

tiffon approved these changes Nov 18, 2018

@tiffon tiffon merged commit e01bc36 into jaegertracing:master Nov 18, 2018

3 checks passed

codecov/patch 100% of diff hit (target 77.08%)
Details
codecov/project 77.15% (+0.06%) compared to feeaccd
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

copa2 added a commit to copa2/jaeger-ui that referenced this pull request Nov 18, 2018

Fix rendering X axis in TraceResultsScatterPlot - pass milliseconds t…
…o moment.js (jaegertracing#274)

* Fix rendering X axis in TraceResultsScatterPlot

Signed-off-by: Ivan Strelkov <iv-strelkov@yandex.ru>

* Test ScatterPlot axis rendering

Signed-off-by: Ivan Strelkov <iv-strelkov@yandex.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.