Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[BOT ISSUE] Google GenAI (Gemini) streaming calls are not instrumented

Đang mở
#61 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
observability

Hướng nghiên cứu

Bắt đầu với BraintrustApiClient.java ở các dòng 186–312 và kiểm tra các phương thức streaming của ApiClient upstream được generateContentStream sử dụng. So sánh cách xử lý SSE và việc tích lũy các chunk trong các triển khai TracingHttpClient của OpenAI và Anthropic, sau đó xem lại BraintrustGenAITest.java. Hoàn tất nghĩa là các lệnh gọi Gemini streaming tạo ra spans, thu thập đầu ra và các chỉ số sử dụng token.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

The Google GenAI instrumentation wraps ApiClient.request() and ApiClient.asyncRequest() for synchronous and asynchronous non-streaming calls, but does not override any streaming methods. Calls to client.models.generateContentStream() and similar streaming APIs bypass the instrumentation entirely, producing no spans, no output capture, and no token usage metrics.

What is missing

BraintrustApiClient.java overrides 4 methods:

  • request(String, String, String, Optional) (line 186)
  • request(String, String, byte[], Optional) (line 210)
  • asyncRequest(String, String, String, Optional) (line 239)
  • asyncRequest(String, String, byte[], Optional) (line 277)

The upstream ApiClient class in the Google GenAI SDK also has streaming request methods (used internally by generateContentStream) that are not overridden. This means streaming Gemini calls — a common pattern for chat applications — are completely invisible to Braintrust tracing.

For comparison, both the OpenAI and Anthropic instrumentations in this repo handle streaming via SSE detection and chunk accumulation in their respective TracingHttpClient implementations.

Upstream sources

Braintrust docs status

  • not_found — braintrust.dev/docs does not reference Google GenAI streaming instrumentation for Java. The Java SDK docs page redirects to the GitHub repo.

Local files inspected

  • braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java — lines 186–312 (only non-streaming request/asyncRequest overridden; no streaming method override)
  • braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustInstrumentation.java — wraps ApiClient in Client and service fields, no streaming awareness
  • braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/dev/braintrust/instrumentation/genai/v1_18_0/BraintrustGenAI.java — thin wrapper, delegates to BraintrustInstrumentation
  • braintrust-sdk/instrumentation/genai_1_18_0/src/test/java/dev/braintrust/instrumentation/genai/v1_18_0/BraintrustGenAITest.java — only tests sync and async non-streaming; no streaming tests exist
Ngôn ngữ chính
Java
Star
21
Fork
5
Merge trung bình
2 ngày 7 giờ
Pull request đã merge (30 ngày)
8

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của braintrustdata/braintrust-sdk-java

Tất cả issue của braintrustdata/braintrust-sdk-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.