Add OTLP Telemetry Export #5771
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Adds optional OTLP (OpenTelemetry Protocol) telemetry export so users can send Kilo Code telemetry data to any OpenTelemetry-compatible backend (Datadog, Honeycomb, Grafana Cloud, Jaeger, etc.). This runs alongside PostHog and does not replace it — it gives power users and teams the ability to observe extension behavior in their own observability stack.
Implementation
The feature spans three layers: a new telemetry client, extension-host wiring, and a settings UI.
New
OtlpTelemetryClient(packages/telemetry/src/OtlpTelemetryClient.ts):BaseTelemetryClientand is registered alongside PostHog/Debug clients viaTelemetryService.register().TASK_CREATED,TASK_COMPLETED,TASK_RESTARTED) are modeled as OpenTelemetry trace spans, giving a parent span per task that contains child events.BatchSpanProcessorandBatchLogRecordProcessorfor efficient batched export over OTLP/HTTP (protobuf).configure()tears down old providers before creating new ones.Extension-host wiring (
src/extension.ts,src/services/telemetry/otlpClientHolder.ts,src/core/webview/webviewMessageHandler.ts):otlpClientHolder.ts) allows the webview message handler to access the client for live reconfiguration when settings change.Settings UI (
webview-ui/src/components/settings/OtelExportSettings.tsx,SettingsView.tsx):globalSettingspipeline and validated with a Zod schema (otlpExportSettingsSchema).Types (
packages/types/src/global-settings.ts,vscode-extension-host.ts):OtlpExportSettingstype and Zod schema.ExtensionStateandWebviewMessagefor state sync.No changes to existing telemetry behavior — OTLP export is opt-in and disabled by default.
How to Test
http://localhost:4318/v1/traces) and/or logs endpoint (http://localhost:4318/v1/logs)For local testing, you can run a Jaeger all-in-one container:
Then use
http://localhost:4318/v1/tracesas the traces endpoint and view results athttp://localhost:16686.Get in Touch
Discord: @comradenalaxone