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

TraceID : Fetching TraceID #6797

Closed
wants to merge 0 commits into from

Conversation

Vanshikav123
Copy link
Contributor

@Vanshikav123 Vanshikav123 commented Oct 12, 2023

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Made changes by adding the TraceID in panel state and fetched the header made a Hover feature for tracing the TraceID

#6774

@Vanshikav123 Vanshikav123 changed the title Fetching TraceID TraceID : Fetching TraceID Oct 12, 2023
@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 13, 2023
@Vanshikav123
Copy link
Contributor Author

Hello @yeya24 Please Review

// Access the response headers
const traceIdHeader = resp.headers.get('X-Thanos-Trace-Id');
// Set the traceId state
this.setState({ traceId: traceIdHeader });
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just join these two lines together into one (https://github.com/thanos-io/thanos/blob/main/docs/contributing/coding-style-guide.md#avoid-defining-variables-used-only-once) and remove the comments since it is obvious what is happening.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Vanshikav123 This is still not addressed.

if (event.target.checked && this.state.traceId) {
this.setState({ hoverMessage: `TraceID: ${this.state.traceId}` });
} else if (event.target.checked) {
this.setState({ hoverMessage: 'TraceID is not available. Enable it in your options.' });
Copy link
Member

Choose a reason for hiding this comment

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

Won't this show up if the option is checked but a query hasn't been executed yet? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will look into it more deeply 👍

@Vanshikav123
Copy link
Contributor Author

Thank you for the reviews i think i should remove the condition checking the force tracing condition and instead check whether the query is executed or not .

@Vanshikav123
Copy link
Contributor Author

Please Review

@@ -116,6 +119,9 @@ class Panel extends Component<PanelProps & PathPrefixProps, PanelState> {
exprInputValue: props.options.expr,
explainOutput: null,
analysis: null,
traceId: null, // Initialize traceId to null.
Copy link
Contributor

Choose a reason for hiding this comment

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

Code is self explanatory. We can remove the comment

@@ -58,6 +58,9 @@ interface PanelState {
exprInputValue: string;
analysis: QueryTree | null;
explainOutput: ExplainTree | null;
traceId: string | null; //Include traceId in the state.
Copy link
Contributor

Choose a reason for hiding this comment

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

Code is self explanatory. We can remove the comment

@yeya24
Copy link
Contributor

yeya24 commented Nov 2, 2023

It is probably also required for you to run make assets to update pkg/ui/bindata.go file.

@yeya24
Copy link
Contributor

yeya24 commented Nov 4, 2023

It is probably also required for you to run make assets to update pkg/ui/bindata.go file.

@Vanshikav123 Can you please regenerate the bindata file?

@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 4, 2023
@Vanshikav123
Copy link
Contributor Author

It is probably also required for you to run make assets to update pkg/ui/bindata.go file.

@Vanshikav123 Can you please regenerate the bindata file?

Done

@yeya24
Copy link
Contributor

yeya24 commented Nov 4, 2023

--- a/pkg/ui/bindata.go
+++ b/pkg/ui/bindata.go
@@ -376,11 +376,13 @@ var _bindata = map[string]func() (*asset, error){
 // directory embedded in the file by go-bindata.
 // For example if you run go-bindata on data/... and data contains the
 // following hierarchy:
-//     data/
-//       foo.txt
-//       img/
-//         a.png
-//         b.png
+//
+//	data/
+//	  foo.txt
+//	  img/
+//	    a.png
+//	    b.png
+//

CI failed. Probably you need to generate bindata again.

@yeya24
Copy link
Contributor

yeya24 commented Nov 4, 2023

I am trying to test this feature but I didn't get how to use it. @Vanshikav123 Can you please update the pr description and mention how the UX works? Where will the traceID be displayed?

@Vanshikav123
Copy link
Contributor Author

I am trying to test this feature but I didn't get how to use it. @Vanshikav123 Can you please update the pr description and mention how the UX works? Where will the traceID be displayed?

Actually i will not be able to provide you with the screenshot because my UI is not responding but i will surely provide you with more information about the PR.

@Vanshikav123
Copy link
Contributor Author

I am trying to test this feature but I didn't get how to use it. @Vanshikav123 Can you please update the pr description and mention how the UX works? Where will the traceID be displayed?

I everytime run make assets after completion of my ui changes , I don't know why these checks are failing .....and I have edited the description of the PR you can review it .

@yeya24
Copy link
Contributor

yeya24 commented Nov 5, 2023

Thanks for updating the pr description. I saw the traceID displayed when I hover over the Force Tracing tab.
image

image

Some suggestions:

  1. Displaying TraceID as a feature shouldn't be bundled with the Force Tracing checkbox... I would like to see users be able to use it without hovering over it. Even if force tracing is not enabled, Thanos backend can still generate the traceID and have it in the response.
  2. I feel it will be more natural displayed here as part of the stats of the response. WDYT?
image

@Vanshikav123
Copy link
Contributor Author

Thanks for updating the pr description. I saw the traceID displayed when I hover over the Force Tracing tab. image

image Some suggestions:
  1. Displaying TraceID as a feature shouldn't be bundled with the Force Tracing checkbox... I would like to see users be able to use it without hovering over it. Even if force tracing is not enabled, Thanos backend can still generate the traceID and have it in the response.
  2. I feel it will be more natural displayed here as part of the stats of the response. WDYT?
image

Thank you ! @yeya24 for this suggestion , I think this will look good and more informative , I will implement this soon

@yeya24
Copy link
Contributor

yeya24 commented Dec 2, 2023

Is this ready for another round of review?

@Vanshikav123
Copy link
Contributor Author

Is this ready for another round of review?

Sorry for the delay , I will push my changes ASAP and will inform you

@Vanshikav123
Copy link
Contributor Author

Hello @yeya24 I would like to close this branch and will open a new PR soon because the implementation is different from what i did earlier.

@Vanshikav123 Vanshikav123 mentioned this pull request Dec 11, 2023
2 tasks
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.

3 participants