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

Add JSON button to trace page #1124

Merged
merged 1 commit into from
Jun 1, 2016
Merged

Add JSON button to trace page #1124

merged 1 commit into from
Jun 1, 2016

Conversation

virtuald
Copy link
Contributor

@virtuald virtuald commented May 28, 2016

Well, since the "privileged minority" hasn't done it yet, I figured I would since I keep finding that I need it. :)

I'm very new to the various frameworks that the UI is using, so I'm open to suggestions if there's anything that I did that was a bit wonky.

@@ -0,0 +1,16 @@
import {component} from 'flightjs';
import $ from 'jquery';
Copy link
Contributor

Choose a reason for hiding this comment

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

Defined, but never used (try running npm run lint)

@eirslett
Copy link
Contributor

I had some comments; otherwise, great work!

@codefromthecrypt
Copy link
Member

codefromthecrypt commented May 29, 2016 via email

@virtuald
Copy link
Contributor Author

Thanks for the comments, I'll address these tonight or tomorrow.

@virtuald
Copy link
Contributor Author

Comments addressed.

@codefromthecrypt
Copy link
Member

running it locally and will merge (and release) after!

@virtuald
Copy link
Contributor Author

I've got another set of changes coming too dealing with better error messages, just testing it now.

@codefromthecrypt
Copy link
Member

ah ok thx for the heads-up. this is a different PR, right?

@virtuald
Copy link
Contributor Author

Yep. Different PR.

@virtuald virtuald mentioned this pull request May 31, 2016
const self = this;
self.raw = data.raw;
Copy link
Member

Choose a reason for hiding this comment

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

how is this controlled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It comes through the trigger in js/component_data/trace.js

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR does not provide a mechanism to do that. I suspect that is best saved for future work -- if there isn't a way to show an uploaded trace, no sense downloading the trace?

I could be convinced otherwise, it would be easy to add an actual raw download link somewhere.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, ha. Didn't realize that.

Copy link
Member

Choose a reason for hiding this comment

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

ex not sure why the website doesn't render it, but here's the definition

  • name: raw
    in: query
    required: false
    description: |
    Note this flag has no value. Ex. /trace/{traceId}?raw
    Normally, the trace endpoint cleans trace data. For example, it merges
    spans by id, adds missing timestamp or duration, corrects clock skew..
    Specifying this flag is a debug case, when you are debugging zipkin
    logic or zipkin instrumentation, and want to see the input to these
    adjusters. For example, this might explain or rule out clock skew.
    type: boolean

https://github.com/openzipkin/zipkin-api/blob/master/zipkin-api.yaml#L146

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. I suppose we could add a mechanism that could display either. I chose the default since it was already retrieved by the server -- so it would show the JSON that's currently being displayed without another call to the server. Theoretically, if you made another call down, the JSON could show something different which wasn't currently being displayed.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to traceJson

@codefromthecrypt
Copy link
Member

fyi here are some screen shots:

screen shot 2016-05-31 at 10 49 49 am

screen shot 2016-05-31 at 10 49 36 am

@yurishkuro
Copy link
Contributor

is json raw or merged?

@virtuald
Copy link
Contributor Author

The JSON should be whatever was retrieved from the call to /api/v1/traces/XXX, as it's the same object.

@codefromthecrypt
Copy link
Member

@yurishkuro you have this feature already.. do you default to raw json? any thoughts about what the default should be?

@yurishkuro
Copy link
Contributor

@adriancole we added two buttons, raw and regular json, as both come in handy. But we just have them as plain links to json documents, not popups, and we leave pretty rendering to browser plugin. That way it's easy to search inside the json, and do a Save As.

@codefromthecrypt
Copy link
Member

interesting. search works fine with the pop-up, but save-as doesn't. It is
a common support case... @virtuald https://github.com/virtuald thoughts
on save-as etc?

@codefromthecrypt
Copy link
Member

screen shot 2016-05-31 at 10 49 36 am

Here's a thought. you can add a save or download link to the pop-up. this could point to /api/v1/trace/id for example.

@eirslett
Copy link
Contributor

+1 for adriancole's suggestion!

@virtuald
Copy link
Contributor Author

I added a save icon, and also the ability to right click on the JSON button and do a save as (as that's an intuitive option anyways).

@@ -167,6 +168,7 @@ export default function traceToMustache(trace) {
const spansBackup = spans;

return {
traceId,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this isn't needed anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's used in trace.mustache line 7.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see it now! Sorry.

- Shows prettified JSON in modal dialog
- Adds download link for JSON
- Fixes #1060
ServiceFilterSearchUI.attachTo('#serviceFilterSearch');
SpanPanelUI.attachTo('#spanPanel');
TraceUI.attachTo('#trace-container');
FilterLabelUI.attachTo('.service-filter-label');
ZoomOut.attachTo('#zoomOutSpans');

this.$node.find('#traceJsonLink').click(e => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eirslett you're right, this ends up being cleaner anyways, it never really belonged in trace.js

@eirslett
Copy link
Contributor

Otherwise, LGTM! ship it

@codefromthecrypt
Copy link
Member

yay json button!

@codefromthecrypt codefromthecrypt merged commit 0976ca5 into openzipkin:master Jun 1, 2016
@virtuald virtuald deleted the json-button branch June 1, 2016 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants