import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb'; import { defineIntegration } from '@sentry/core'; import { generateInstrumentOnce } from '../../otel/instrument.js'; import { addOriginToSpan } from '../../utils/addOriginToSpan.js'; const INTEGRATION_NAME = 'Mongo'; const instrumentMongo = generateInstrumentOnce( INTEGRATION_NAME, () => new MongoDBInstrumentation({ responseHook(span) { addOriginToSpan(span, 'auto.db.otel.mongo'); }, }), ); const _mongoIntegration = (() => { return { name: INTEGRATION_NAME, setupOnce() { instrumentMongo(); }, }; }) ; /** * Adds Sentry tracing instrumentation for the [mongodb](https://www.npmjs.com/package/mongodb) library. * * For more information, see the [`mongoIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongo/). * * @example * ```javascript * const Sentry = require('@sentry/node'); * * Sentry.init({ * integrations: [Sentry.mongoIntegration()], * }); * ``` */ const mongoIntegration = defineIntegration(_mongoIntegration); export { instrumentMongo, mongoIntegration }; //# sourceMappingURL=mongo.js.map