Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
import { defineIntegration, captureException, flush, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
|
|
import { generateInstrumentOnce, addOriginToSpan } from '@sentry/node-core';
|
|
import { FirebaseInstrumentation } from './otel/firebaseInstrumentation.js';
|
|
|
|
const INTEGRATION_NAME = 'Firebase';
|
|
|
|
const config = {
|
|
firestoreSpanCreationHook: span => {
|
|
addOriginToSpan(span, 'auto.firebase.otel.firestore');
|
|
|
|
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'db.query');
|
|
},
|
|
functions: {
|
|
requestHook: span => {
|
|
addOriginToSpan(span, 'auto.firebase.otel.functions');
|
|
|
|
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.request');
|
|
},
|
|
errorHook: async (_, error) => {
|
|
if (error) {
|
|
captureException(error, {
|
|
mechanism: {
|
|
type: 'auto.firebase.otel.functions',
|
|
handled: false,
|
|
},
|
|
});
|
|
await flush(2000);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
|
|
const instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME, () => new FirebaseInstrumentation(config));
|
|
|
|
const _firebaseIntegration = (() => {
|
|
return {
|
|
name: INTEGRATION_NAME,
|
|
setupOnce() {
|
|
instrumentFirebase();
|
|
},
|
|
};
|
|
}) ;
|
|
|
|
const firebaseIntegration = defineIntegration(_firebaseIntegration);
|
|
|
|
export { firebaseIntegration, instrumentFirebase };
|
|
//# sourceMappingURL=firebase.js.map
|