Restoring dropped Gemini chat config in Sentry's JavaScript SDK
Описание и применение
Исправлена потеря конфигурации Gemini в трассах Sentry, восстановлены все атрибуты модели.
Задача
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