-
Notifications
You must be signed in to change notification settings - Fork 213
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
Chat: Add tracing #3168
Chat: Add tracing #3168
Conversation
WOOOO |
if (inputText.match(/^\/reset$/)) { | ||
return this.clearAndRestartSession() | ||
} | ||
return tracer.startActiveSpan('chat.submit', async (span): Promise<void> => { |
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.
noob question: should we start the active span from when the question is submitted (from the command menu, chat view, or commands), or we only want to trace when we handle the request that was sent here?
If i want to add the tracing from when the command was executed, so we can trace how long it takes before it arrives to this function, do i just add another active span to that?
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.
Ideally as early as possible but when the trace is started it does not happen in the same JavaScript thread (it happens in the UI thread and not the extension host) so I put it here instead. Do you think there is a long delay until it arrives here?
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.
Do you think there is a long delay until it arrives here?
At least for commands, we fetch the context before they are sent here so it'd be cool to see those. I will add it to commands based off your branch and try it out!
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.
Ah, yeah for the simple chat provider I think this function is called pretty much immediately after the webview message arrives. Context fetching happens later
Context: https://sourcegraph.slack.com/archives/C05AGQYD528/p1707924889951959 Based off #3168 Add tracing to Command and Custom Command on execution time. ## Test plan <!-- Required. See https://sourcegraph.com/docs/dev/background-information/testing_principles. --> Add tracing. Tracing for explain command: ![image](https://github.com/sourcegraph/cody/assets/68532117/6ca97c3a-039e-4bc1-b86e-c3a6b8de193d) Tracing for smell command: ![image](https://github.com/sourcegraph/cody/assets/68532117/c6e55bca-653a-49c1-b333-58ba1601c10c) Tracing for doc command: ![image](https://github.com/sourcegraph/cody/assets/68532117/54983860-3cdc-41b2-b2cc-c729eb3fd4b9) Tracing for test command: ![image](https://github.com/sourcegraph/cody/assets/68532117/418b3aa0-8e4c-437b-b6f1-fdf8dce6ce8f) Tracing for custom command: ![image](https://github.com/sourcegraph/cody/assets/68532117/92e2645d-6f44-452e-80e7-096b2d22ff18) --------- Co-authored-by: Philipp Spiess <hello@philippspiess.com>
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 for setting this up again!!
As the title suggests. Please review with whitespace changes hidden.
Test plan
e.g.: https://ui.honeycomb.io/sourcegraph/environments/cody/datasets/cody-client/result/oy1kwHxdSmP/trace/9xmczeHgPAu?fields[]=s_name&fields[]=s_serviceName&span=6dc03ea5de6419ae