Skip to content

Commit

Permalink
Integrate OpenTelemetry tracing in Cody Webview (#6100)
Browse files Browse the repository at this point in the history
Enhance the chat application by integrating OpenTelemetry for tracing
and context management. This update includes:

- Added OpenTelemetry dependencies for context and tracing.
- Implemented tracing spans in chat interactions, feedback submission in
Webview
- Managed active chat context using OpenTelemetry's context API.
- Introduced a telemetry service for managing tracing configuration.
- Added a new class for exporting trace data in `ChatController` from
the webview

These changes aim to improve observability and debugging capabilities by
providing detailed trace information for chat interactions and
operations

## Test plan
- Run sourcegraph instance locally
- Run `sg start otel `
- Run the debugger for vscode cody locally on this branch
- Perform some chat operations 
- Go to `http://localhost:16686`  to see if Jaegar is running
- Select Cody-Client as the service
- See a trace with the title `chat-interaction ` this is a trace coming
from the webview
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/2ba1dc6b-5da9-42c5-a4da-b04cf8527287">

Here is a video
https://www.loom.com/share/557b0ea9dffd4561810f8d67879f7dfb
 
<!-- Required. See
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles.
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
  • Loading branch information
arafatkatze authored Nov 21, 2024
1 parent 6cafd13 commit f747f6e
Show file tree
Hide file tree
Showing 15 changed files with 828 additions and 98 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
},
"dependencies": {
"@openctx/client": "^0.0.30",
"@opentelemetry/sdk-trace-web": "^1.18.1",
"@sourcegraph/telemetry": "^0.18.0",
"observable-fns": "^0.6.1",
"react": "18.2.0",
Expand All @@ -78,6 +79,7 @@
},
"pnpm": {
"overrides": {
"tslib": "2.1.0",
"@lexical/react": "https://storage.googleapis.com/sourcegraph-assets/npm/lexical-react-sourcegraph-fork-31065486.tgz"
},
"packageExtensions": {
Expand Down
Loading

0 comments on commit f747f6e

Please sign in to comment.