Skip to content

feat(deno): add google-genai integration - #22469

Merged
isaacs merged 1 commit into
isaacs/deno-orchestrion-integrations-anthropicfrom
isaacs/deno-orchestrion-integrations-google-genai
Jul 24, 2026
Merged

feat(deno): add google-genai integration#22469
isaacs merged 1 commit into
isaacs/deno-orchestrion-integrations-anthropicfrom
isaacs/deno-orchestrion-integrations-google-genai

Conversation

@isaacs

@isaacs isaacs commented Jul 21, 2026

Copy link
Copy Markdown
Member

No description provided.

@isaacs
isaacs requested a review from a team as a code owner July 21, 2026 20:30
@isaacs
isaacs requested review from JPeer264 and andreiborza and removed request for a team July 21, 2026 20:30
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from a3bda7b to af2805c Compare July 21, 2026 20:55
@isaacs
isaacs requested a review from a team as a code owner July 21, 2026 20:55
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from af2805c to 46512ae Compare July 21, 2026 21:31
Comment on lines +69 to +72
Deno.test('google-genai instrumentation: orchestrion @google/genai:generate-content channel produces a nested gen_ai span', async () => {
resetGlobals();
const sink = transactionSink();
init({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: A module-level installedIntegrations array is not cleared between tests, causing subsequent init() calls to skip setup and leading to test failures.
Severity: MEDIUM

Suggested Fix

The installedIntegrations array should be cleared between tests. This can be done by exporting a reset function from @sentry/core that clears the array and then calling this new function within resetGlobals(). This will ensure each test runs in a clean state.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts#L69-L72

Potential issue: A module-level array, `installedIntegrations`, is not cleared between
tests, even when `resetGlobals()` is called. When a second test in the same file calls
`init()`, the integration's `setupOnce()` function is skipped because the integration
name is already present in the array from the first test's execution. This prevents
diagnostic channel subscriptions from being set up for the second test. Consequently,
the test times out waiting for a transaction that is never created, causing a test
failure.

Also affects:

  • packages/core/src/integration.ts:10
  • packages/core/src/integration.ts:117~119

Did we get this right? 👍 / 👎 to inform future reviews.

@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from 46512ae to 46e8ba9 Compare July 21, 2026 21:42
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from 46e8ba9 to a2edc7e Compare July 22, 2026 00:51
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from a2edc7e to ac2a96d Compare July 22, 2026 14:42
@isaacs
isaacs requested review from a team as code owners July 22, 2026 14:42
@isaacs
isaacs requested review from chargome, msonnb and mydea and removed request for a team July 22, 2026 14:42
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from ac2a96d to dd3e8b8 Compare July 22, 2026 22:02
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 27.95 kB - -
@sentry/browser - with treeshaking flags 26.39 kB - -
@sentry/browser (incl. Tracing) 46.41 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.18 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.21 kB - -
@sentry/browser (incl. Tracing, Replay) 85.69 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.33 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.4 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.06 kB - -
@sentry/browser (incl. Feedback) 45.13 kB - -
@sentry/browser (incl. sendFeedback) 32.74 kB - -
@sentry/browser (incl. FeedbackAsync) 37.8 kB - -
@sentry/browser (incl. Metrics) 29.04 kB - -
@sentry/browser (incl. Logs) 29.26 kB - -
@sentry/browser (incl. Metrics & Logs) 29.97 kB - -
@sentry/react 29.75 kB - -
@sentry/react (incl. Tracing) 48.71 kB - -
@sentry/vue 33.38 kB - -
@sentry/vue (incl. Tracing) 48.4 kB - -
@sentry/svelte 27.97 kB - -
CDN Bundle 30.28 kB - -
CDN Bundle (incl. Tracing) 48.26 kB - -
CDN Bundle (incl. Logs, Metrics) 31.85 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.58 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 71.13 kB - -
CDN Bundle (incl. Tracing, Replay) 85.83 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.89 kB - -
CDN Bundle - uncompressed 90.15 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.22 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.86 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.2 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.62 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.46 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.42 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.16 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.11 kB - -
@sentry/nextjs (client) 51.24 kB - -
@sentry/sveltekit (client) 46.84 kB - -
@sentry/core/server 80.05 kB - -
@sentry/core/browser 52.01 kB - -
@sentry/node 123.14 kB - -
@sentry/node (incl. diagnostics channel injection) 167.14 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B - -
@sentry/node - without tracing 73.31 kB - -
@sentry/aws-serverless 82.82 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 197.05 kB - -
@sentry/cloudflare (withSentry) 484.73 kB - -

View base workflow run

@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from dd3e8b8 to d8bf614 Compare July 23, 2026 14:29
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from d8bf614 to 8a0503f Compare July 23, 2026 18:10
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch 2 times, most recently from fde4dd2 to 84fe78c Compare July 23, 2026 21:19
Comment on lines +64 to +72
Deno.test('google-genai instrumentation: orchestrion @google/genai:generate-content channel produces a nested gen_ai span', async () => {
resetGlobals();
const sink = transactionSink();
init({
dsn: 'https://username@domain/123',
tracesSampleRate: 1,
beforeSendTransaction: sink.beforeSendTransaction,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The module-level subscribed flag in the google-genai integration is not reset between tests, causing subsequent init() calls in the same file to fail to set up tracing.
Severity: MEDIUM

Suggested Fix

Export a reset function from the google-genai.ts integration module that sets the subscribed flag back to false. Call this new reset function from within the resetGlobals() helper in the test suite to ensure a clean state between test runs.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts#L64-L72

Potential issue: The `google-genai.ts` integration uses a module-level `subscribed` flag
to prevent re-subscribing to diagnostics channels. In the Deno test environment, tests
within the same file share module scope. The first test sets `subscribed` to `true`. A
`resetGlobals()` function is called between tests, but it fails to reset this
module-level flag. Consequently, when the second test calls `init()`, the integration's
`setupOnce()` function sees that `subscribed` is already `true` and exits prematurely,
skipping the channel subscription logic. This causes the second test to fail its
assertion, as no AI span is created.

@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch 2 times, most recently from 9ebec22 to 35a3aec Compare July 23, 2026 22:47
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from 35a3aec to 5718dfb Compare July 24, 2026 01:24
@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from 5718dfb to 08f6136 Compare July 24, 2026 14:31
Comment on lines +57 to +62
Deno.test('google-genai instrumentation: included in default integrations (Deno 2.8.0+)', () => {
resetGlobals();
const client = init({ dsn: 'https://username@domain/123' }) as DenoClient;
const names = client.getOptions().integrations.map(i => i.name);
assert(names.includes('Google_GenAI'), `Google_GenAI should be in defaults, got ${names.join(', ')}`);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The test unconditionally asserts Google_GenAI is a default integration, but it's only included on Deno 2.8.0+. This will cause test failures on older Deno versions.
Severity: MEDIUM

Suggested Fix

Conditionally skip the test assertion if the Deno version is less than 2.8.0. This can be achieved by checking the MODULE_REGISTER_HOOKS_SUPPORTED flag within the test file and only running the assertion if it's true. This will align the test's logic with the SDK's conditional inclusion logic.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts#L57-L62

Potential issue: The `googleGenAIChannelIntegration()` is conditionally added to the
default integrations only on Deno versions 2.8.0 and newer, controlled by the
`MODULE_REGISTER_HOOKS_SUPPORTED` flag. However, the corresponding integration test
unconditionally asserts that the `'Google_GenAI'` integration is present in the
defaults. This discrepancy will cause the test to fail when run in an environment with a
Deno version older than 2.8.0, as the test suite does not enforce a minimum Deno
version. This pattern is reportedly present in over 20 other integration tests,
indicating a systemic issue.

Also affects:

  • packages/deno/src/sdk.ts:96~102

@isaacs
isaacs force-pushed the isaacs/deno-orchestrion-integrations-google-genai branch from 08f6136 to 9b9fef7 Compare July 24, 2026 15:13
@isaacs
isaacs merged commit df71100 into develop Jul 24, 2026
64 of 92 checks passed
@isaacs
isaacs deleted the isaacs/deno-orchestrion-integrations-google-genai branch July 24, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants