mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #20716] [CLOSED] fix(telemetry): respect OTel env headers and instrument LLM token usage #48793
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20716
Author: @execsumo
Created: 1/16/2026
Status: ❌ Closed
Base:
main← Head:fix/otel-braintrust-config📝 Commits (1)
0dbaaa4fix(otel): allow env vars to override empty headers and add token usage instrumentation📊 Changes
3 files changed (+21 additions, -4 deletions)
View changed files
📝
backend/open_webui/utils/telemetry/instrumentors.py(+17 -0)📝
backend/open_webui/utils/telemetry/metrics.py(+2 -2)📝
backend/open_webui/utils/telemetry/setup.py(+2 -2)📄 Description
Problem
headersargument was explicitly initialized as[](if no internal basic auth was set). This value is passed to the OTel exporter, causing it to ignore the standardOTEL_EXPORTER_OTLP_HEADERSenvironment variable. This broke integration with OTel providers that rely on header-based authentication (e.g., Braintrust, Honeycomb).x-openai-usage) was not being captured in the OTel traces.Solution
headers=(headers or None). PassingNoneallows the OpenTelemetry SDK to correctly fall back to reading headers from the environment.aiohttpandhttpxhooks. Start capturing headers matching "usage", "token", or "x-request-id" and add them as span attributes (prefixed withllm.header.).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.