Restoring dropped Gemini chat config in Sentry's JavaScript SDK
说明与用途
修复了 Sentry 中 Gemini 配置丢失的问题,恢复了所有模型属性。
问题
Sentry’s JavaScript SDK lost Gemini chat configuration attributes in trace spans after a refactor, making AI tracing incomplete.
结果
The patch restores missing Gemini chat configuration attributes in Sentry traces, enabling accurate AI debugging and cost analysis.
工作流
- Identify regression via missing span attributes
- Analyze deep proxy re‑instrumentation logic
- Create mergeChatCreateParams helper to combine create‑time and per‑message config
- Thread create arguments through proxy in createDeepProxy
- Update instrumentMethod to use merged params for span attributes
- Add unit tests covering config welding and non‑chat calls
- Run full @sentry/server-utils test suite (339 passing)
- Verify fix against live Gemini API, confirming attributes present
证据
The fix captures the chats.create() arguments and welds model plus config onto each message span.
Both runs got a real Gemini reply. The AFTER run answered: "Why did the programmer quit his job debugging code? Because he kept finding himself in an infinite loop."
- 记录日期: 2026-09-10T00:46:08.081Z