Skip to content

ref(node): Streamline Firebase instrumentation#21748

Open
nicohrubec wants to merge 1 commit into
developfrom
nh/streamline-firebase
Open

ref(node): Streamline Firebase instrumentation#21748
nicohrubec wants to merge 1 commit into
developfrom
nh/streamline-firebase

Conversation

@nicohrubec

@nicohrubec nicohrubec commented Jun 24, 2026

Copy link
Copy Markdown
Member

Streamlines the firebase instrumentation:

  • Folds attributes set via hooks into the instrumentation.
  • Use startSpan APIs from @sentry/core.
  • Remove code paths e.g. configs.
  • No tests added since this should be sufficiently covered already.

Create Firebase spans via the `@sentry/core` `startSpan` API instead of the OTel
tracer, and fold the integration's firestore/functions hooks (origin, op,
captureException) directly into the instrumentation.

Ref JS-2848

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 24, 2026

Copy link
Copy Markdown

JS-2848

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4e752d2. Configure here.

handled: false,
},
});
await flush(2000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Flush runs before span ends

High Severity

On handler failure, captureException and await flush(2000) run inside the startSpan callback before the error is rethrown. startSpan only ends the function span after that rejection, so the flush can drain the queue while the span is still open and before span.end() enqueues the finished transaction. In short-lived Firebase Functions, telemetry from the ended span may never be sent.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4e752d2. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

valid. Technically it is a replacement of the errorHook, but now everything is inside the startSpan. To achieve this I think an interactive span should be used instead to achieve the same.

@github-actions

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.47 kB - -
@sentry/browser - with treeshaking flags 25.91 kB - -
@sentry/browser (incl. Tracing) 45.97 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.72 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.76 kB - -
@sentry/browser (incl. Tracing, Replay) 85.22 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.81 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.91 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.57 kB - -
@sentry/browser (incl. Feedback) 44.66 kB - -
@sentry/browser (incl. sendFeedback) 32.26 kB - -
@sentry/browser (incl. FeedbackAsync) 37.4 kB - -
@sentry/browser (incl. Metrics) 28.54 kB - -
@sentry/browser (incl. Logs) 28.78 kB - -
@sentry/browser (incl. Metrics & Logs) 29.47 kB - -
@sentry/react 29.27 kB - -
@sentry/react (incl. Tracing) 48.28 kB - -
@sentry/vue 32.63 kB - -
@sentry/vue (incl. Tracing) 47.84 kB - -
@sentry/svelte 27.5 kB - -
CDN Bundle 29.88 kB - -
CDN Bundle (incl. Tracing) 47.9 kB - -
CDN Bundle (incl. Logs, Metrics) 31.44 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.24 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.77 kB - -
CDN Bundle (incl. Tracing, Replay) 85.41 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.45 kB - -
CDN Bundle - uncompressed 88.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.02 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 93.65 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.63 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.04 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.74 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.69 kB - -
@sentry/nextjs (client) 50.67 kB - -
@sentry/sveltekit (client) 46.37 kB - -
@sentry/core/server 76.33 kB - -
@sentry/core/browser 63.48 kB - -
@sentry/node-core 61.63 kB - -
@sentry/node 123.1 kB -0.42% -512 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.55 kB - -
@sentry/node - without tracing 73.7 kB - -
@sentry/aws-serverless 84.9 kB - -
@sentry/cloudflare (withSentry) - minified 175.71 kB - -
@sentry/cloudflare (withSentry) 437.12 kB - -

View base workflow run

@nicohrubec nicohrubec marked this pull request as ready for review June 24, 2026 12:17
@nicohrubec nicohrubec requested a review from a team as a code owner June 24, 2026 12:17
@nicohrubec nicohrubec requested review from JPeer264, andreiborza and mydea and removed request for a team June 24, 2026 12:17

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything looks good, except the clankers objection. Once this is resolved I'll review again

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.

2 participants