feat(telemetry): add diagnostic properties to Gemini API error telemetry #10667
+43
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When Gemini API errors occur (like
INVALID_ARGUMENTwith code 400), the error messages are too vague to diagnose the root cause. This PR adds diagnostic properties to thecaptureException()call in the Gemini handler'screateMessage()method.Problem
A PostHog error showed only:
This provides no information about which argument is invalid or what caused the issue.
See original PostHog issue: https://us.posthog.com/error_tracking/019bb205-1968-7581-b2c9-9b7f27537d3d
Solution
Add diagnostic properties to the telemetry capture:
messageCountgeminiContentsCounthasToolUseBlockshasToolResultBlockshasImageBlocksemptyPartsCounttoolIdToNameSizehasThinkingConfigusingNativeToolsincludeThoughtSignaturesTesting
Linear Issue
Resolves ROO-515
Important
Adds diagnostic properties to
GeminiHandler.createMessage()telemetry for better error context in API errors.captureException()inGeminiHandler.createMessage()for better error context.messageCount,geminiContentsCount,hasToolUseBlocks,hasToolResultBlocks,hasImageBlocks,emptyPartsCount,toolIdToNameSize,hasThinkingConfig,usingNativeTools,includeThoughtSignatures.gemini.spec.tsto verify diagnostic properties in telemetry capture forcreateMessageerrors.This description was created by
for 16529b7. You can customize this summary. It will automatically update as commits are pushed.