add experimental.open_telemetry config option to enable OTEL spans (#4978)

Co-authored-by: noamzbr <noamzbr@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
Noam Bressler
2025-12-05 18:48:22 +02:00
committed by GitHub
parent cfbaf81ef8
commit 864c098701
5 changed files with 18 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ import { Command } from "../command"
import { $, fileURLToPath } from "bun"
import { ConfigMarkdown } from "../config/markdown"
import { SessionSummary } from "./summary"
import { Config } from "../config/config"
import { NamedError } from "@opencode-ai/util/error"
import { fn } from "@/util/fn"
import { SessionProcessor } from "./processor"
@@ -433,6 +434,7 @@ export namespace SessionPrompt {
}
// normal processing
const cfg = await Config.get()
const agent = await Agent.get(lastUser.agent)
msgs = insertReminders({
messages: msgs,
@@ -613,6 +615,7 @@ export namespace SessionPrompt {
},
],
}),
experimental_telemetry: { isEnabled: cfg.experimental?.openTelemetry },
})
if (result === "stop") break
continue
@@ -1418,6 +1421,7 @@ export namespace SessionPrompt {
input.history.filter((m) => m.info.role === "user" && !m.parts.every((p) => "synthetic" in p && p.synthetic))
.length === 1
if (!isFirst) return
const cfg = await Config.get()
const small =
(await Provider.getSmallModel(input.providerID)) ?? (await Provider.getModel(input.providerID, input.modelID))
const language = await Provider.getLanguage(small)
@@ -1464,6 +1468,7 @@ export namespace SessionPrompt {
],
headers: small.headers,
model: language,
experimental_telemetry: { isEnabled: cfg.experimental?.openTelemetry },
})
.then((result) => {
if (result.text)