feat(server-utils): Migrate FirebaseInstrumentation to orchestrion#22141
feat(server-utils): Migrate FirebaseInstrumentation to orchestrion#22141mydea wants to merge 3 commits into
FirebaseInstrumentation to orchestrion#22141Conversation
Adds an orchestrion diagnostics-channel `Firebase` integration in
`@sentry/server-utils`, replacing the `InstrumentationBase` approach when
`experimentalUseDiagnosticsChannelInjection()` is enabled (swapping in 1:1 for
the OTel `Firebase` integration by name).
- Firestore: subscribes to `orchestrion:@firebase/firestore:{add,get,set,delete}-doc`
and emits the same `db.query` spans via `bindTracingChannelToSpan`, with a
distinct `auto.firebase.orchestrion.firestore` origin.
- firebase-functions: subscribes to `orchestrion:firebase-functions:*` and
rewraps the handler argument of each `onX(...)` registration in the channel's
`start` so the returned cloud function opens a SERVER span + error boundary on
invocation, with `auto.firebase.orchestrion.functions` origin.
Closes #20919
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This depends on nodejs/orchestrion-js#90 being released (and subsequently released in tracing-hooks etc), as we need to target hashed files: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8aabf34. Configure here.
| return startSpanManual( | ||
| { | ||
| name: `firebase.function.${triggerType}`, | ||
| op: 'function.firebase', |
There was a problem hiding this comment.
Wrong Firebase functions span op
Medium Severity
The orchestrion firebase-functions wrapper sets sentry.op to function.firebase, but the existing OTel integration uses http.request for the same spans and the PR states orchestrion output should match OTel aside from origin. Instrumented Cloud Functions therefore emit a different op than the default path and than the new unit test expects.
Reviewed by Cursor Bugbot for commit 8aabf34. Configure here.
size-limit report 📦
|


Rewrites the
Firebaseintegration offInstrumentationBaseto an orchestrion diagnostics-channel listener in@sentry/server-utils, following the mysql (#20900) and graphql (#21885) migrations. The channel-based integration reuses the OTelFirebasename, so opting in viaexperimentalUseDiagnosticsChannelInjection()swaps it in 1:1 for the OTel one (which stays the default).Firestore — subscribes to
orchestrion:@firebase/firestore:{add,get,set,delete}-doc(injected into firestore's liteaddDoc/getDocs/setDoc/deleteDoc) and emits the samedb.queryclient spans viabindTracingChannelToSpan, with a distinctauto.firebase.orchestrion.firestoreorigin.firebase-functions — the
onX(...)provider functions register a handler and return synchronously, so the span can't be bound to the registration call. Instead the channelstartsubscriber rewraps the handler argument (orchestrion forwards the mutated args array to the real call), so the returned cloud function opens aSERVERspan + error boundary on invocation, withauto.firebase.orchestrion.functionsorigin.The
node-firebasee2e firestore suite additionally runs withE2E_ORCHESTRION=trueto assert the orchestrion origin.Closes #20919
🤖 Generated with Claude Code