Rocky_Mountain_Vending/.pnpm-store/v10/files/bb/885d0a08b3d676c45f36c719680232239e0b85a87bc643f67d1310987d525b8dd844790ed4a533b8e6190e6674a1f757acdba2d8dfa4a32d2380f322231f16
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

89 lines
2.3 KiB
Text

import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
import { defineIntegration } from '@sentry/core';
import { generateInstrumentOnce, addOriginToSpan } from '@sentry/node-core';
const INTEGRATION_NAME = 'Mongo';
const instrumentMongo = generateInstrumentOnce(
INTEGRATION_NAME,
() =>
new MongoDBInstrumentation({
dbStatementSerializer: _defaultDbStatementSerializer,
responseHook(span) {
addOriginToSpan(span, 'auto.db.otel.mongo');
},
}),
);
/**
* Replaces values in document with '?', hiding PII and helping grouping.
*/
function _defaultDbStatementSerializer(commandObj) {
const resultObj = _scrubStatement(commandObj);
return JSON.stringify(resultObj);
}
function _scrubStatement(value) {
if (Array.isArray(value)) {
return value.map(element => _scrubStatement(element));
}
if (isCommandObj(value)) {
const initial = {};
return Object.entries(value)
.map(([key, element]) => [key, _scrubStatement(element)])
.reduce((prev, current) => {
if (isCommandEntry(current)) {
prev[current[0]] = current[1];
}
return prev;
}, initial);
}
// A value like string or number, possible contains PII, scrub it
return '?';
}
function isCommandObj(value) {
return typeof value === 'object' && value !== null && !isBuffer(value);
}
function isBuffer(value) {
let isBuffer = false;
if (typeof Buffer !== 'undefined') {
isBuffer = Buffer.isBuffer(value);
}
return isBuffer;
}
function isCommandEntry(value) {
return Array.isArray(value);
}
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 { _defaultDbStatementSerializer, instrumentMongo, mongoIntegration };
//# sourceMappingURL=mongo.js.map