[bot] OpenAI Realtime API (WebSocket) not instrumented
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- java
- Domain
- api, observability
Research direction
Start in the openai_2_15_0 module by inspecting how TracingHttpClient wraps HttpClient and how client.beta().realtime() establishes its WebSocket connection. Identify a stable WebSocket or RealtimeClient hook, then determine how session events and deltas can be captured. Done means Realtime sessions emit a span with input/output JSON and available token metrics, or the limitation is documented if no stable hook exists.
Written by the indexing model from the issue text.
Description
Gap description
The openai-java SDK v2.15.0+ exposes a WebSocket-based Realtime API under client.beta().realtime(). The current instrumentation in openai_2_15_0 works by wrapping the SDK's HttpClient interface (execute / executeAsync), which only intercepts HTTP/HTTPS requests. WebSocket connections are established through a separate code path and are never passed through TracingHttpClient, so no span is created for any Realtime API session.
Affected surface
| SDK | API surface | Transport |
|---|---|---|
com.openai:openai-java:2.15.0+ |
client.beta().realtime() |
WebSocket (WSS) |
Why it matters
Realtime API sessions carry voice and text generation work that is billable and latency-sensitive — exactly the kind of LLM execution Braintrust is designed to observe. Without instrumentation, users see a complete blind spot for this API even when all other OpenAI calls are traced.
Analogous gap already tracked
Issue #120 tracks the same problem for the Google GenAI Live (streaming) API, which also uses a persistent bidirectional connection that bypasses the HTTP-layer hook.
Suggested approach
- Identify the WebSocket-abstraction interface in
openai-java(likelyWebSocketor aRealtimeClient). - Use ByteBuddy to intercept session open/message/close events, or wrap the WebSocket factory the same way
TracingHttpClientwrapsHttpClient. - Accumulate audio/text deltas and emit a span on session close with
braintrust.input_json/braintrust.output_jsonand token metrics where available.
Notes
- This gap exists only in the
openai_2_15_0module; no other provider currently wraps a WebSocket transport. - If the upstream SDK does not yet expose a stable hook point, a note in the docs would at minimum set user expectations.
- Dominant language
- Java
- Stars
- 21
- Forks
- 5
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from braintrustdata/braintrust-sdk-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
All issues in braintrustdata/braintrust-sdk-java
Similar issues
-
certification
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Openbug ecr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Needs: Triage Type: Feature request
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·