Conversation
- Updated bun.lock and package.json to include OpenTelemetry dependencies. - Implemented tracing in various components including session management and tool execution. - Enhanced error handling and event logging for better observability.
|
I think opencode already emits telemetry spans if you set: experimental_opentelemetry to true in your opencode.json |
…lemetry - Moved Tracing initialization to occur before the root CLI span is created. - Wrapped CLI parsing in a span to include command-line arguments in telemetry.
|
Thanks for the quick response @rekram1-node. I set the following and it didn't work: //.opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"experimental": {
"openTelemetry": true
},
}I had to modify the repo to get it to emit open telemetry. |
|
Would be nice to have something like this https://www.reddit.com/r/ClaudeCode/comments/1pjon1r/til_that_claude_code_has_opentelemetry_metrics/ |
|
Hi, doesn't work for me either. Minimally, additional packages from OpenTelemetry JavaScript SDK need to be added |
|
I love this feature, is it possible to add open telemetry support and contains productivity metrics (such as acceptance rate or lines of code) like claude code? https://code.claude.com/docs/en/monitoring-usage#lines-of-code-counter |
|
Working on a PR to fully enable OTEL for opencode in a container image. Hope to be able to share it soon |
|
If it helps. I submitted a merge request to add otel support awhile back, but it got very little traction: |
|
@Phantal : Yes, I saw your PR. On my side, I am trying to obtain full leverage of AI SDK Otel implementation by Vercel. I want to add much less code than your PR and just minimally change the current Otel setup. |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
|
Let me document how OTel in OpenCode works without this PR. I tested the current OpenCode (opencode-ai@1.1.51, opencode-ai@1.1.53, without this PR), and the spans are emitted/exported subject to the following pre-requisites:
Here:
There are 3 types (i.e. 3 values of span.name) logged: ai.streamText, ai.toolCall, ai.streamText.doStream. The spans are not coming directly from OpenCode but from Vercel AI SDK opencode is using. They contain full text of prompts. Here is one of 3 lines where span is created: https://github.com/vercel/ai/blob/c36a873ce00892a4c587c2e9492220b392aefd09/packages/ai/src/generate-text/stream-text.ts#L1142 |
Hi @thdxr, @adamdotdevin, and @rekram1-node
I love opencode. Trying to run it with open telemetry and wanted to add back some code to the project. If you generaly like this commit, I can work on resolving the merge conflict (just imports, nothing big).
Summary
Changes