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>
1 line
No EOL
12 KiB
Text
1 line
No EOL
12 KiB
Text
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0CAA0C;AAC1C,oEAMwC;AACxC,8EAI6C;AAC7C,0DAAmE;AAGnE,mCAMiB;AACjB,kBAAkB;AAClB,uCAA0D;AAI1D,MAAM,iBAAiB,GAAG,CAAC,YAAY,CAAC,CAAC;AAEzC,MAAa,qBAAsB,SAAQ,qCAAgD;IAKzF,YAAY,SAAsC,EAAE;QAClD,KAAK,CAAC,sBAAY,EAAE,yBAAe,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAES,IAAI;QACZ,IAAI,MAA8B,CAAC;QACnC,SAAS,iBAAiB,CAAC,aAAkB;YAC3C,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,EAAE;gBACnC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;aAC/B;QACH,CAAC;QACD,MAAM,KAAK,GAAG,CAAC,mBAA0C,EAAE,EAAE;YAC3D,IAAI,IAAA,2BAAS,EAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE;gBACxC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;aAC5C;YACD,IAAI,CAAC,KAAK,CACR,mBAAmB,EACnB,OAAO,EACP,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAQ,CACvC,CAAC;YACF,IAAI,IAAA,2BAAS,EAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE;gBAC1C,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;aAC9C;YACD,IAAI,CAAC,KAAK,CACR,mBAAmB,EACnB,SAAS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,CAAC,mBAAmB,CAAC,OAAO,CAAC,CACxC,CAAC;iBACH;qBAAM,IAAI,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE;oBAC7C,UAAU,CAAC,KAAK,CACd,SAAS,EACT,CAAC,EACD,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,CACxC,CAAC;iBACH;gBAED,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC9C,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;IAEO,mBAAmB,CAAC,OAAiB;QAC3C,OAAO,CAAC,gBAA0B,EAAE,EAAE;YACpC,OAAO,UACL,GAAiC,EACjC,OAAa,EACb,MAAiC;gBAEjC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBACtB,OAAO,gBAAgB,CAAC,GAAG,SAAS,CAAC,CAAC;YACxC,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;;AAvMH,sDAwMC;AAvMiB,uCAAiB,GAAG;IAClC,CAAC,yCAAkB,CAAC,EAAE,2CAAoB;CAC3C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as api from '@opentelemetry/api';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n isWrapped,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n DBSYSTEMVALUES_MYSQL,\n SEMATTRS_DB_STATEMENT,\n SEMATTRS_DB_SYSTEM,\n} from '@opentelemetry/semantic-conventions';\nimport { addSqlCommenterComment } from '@opentelemetry/sql-common';\nimport type * as mysqlTypes from 'mysql2';\nimport { MySQL2InstrumentationConfig } from './types';\nimport {\n getConnectionAttributes,\n getConnectionPrototypeToInstrument,\n getDbStatement,\n getSpanName,\n once,\n} from './utils';\n/** @knipignore */\nimport { PACKAGE_NAME, PACKAGE_VERSION } from './version';\n\ntype formatType = typeof mysqlTypes.format;\n\nconst supportedVersions = ['>=1.4.2 <4'];\n\nexport class MySQL2Instrumentation extends InstrumentationBase<MySQL2InstrumentationConfig> {\n static readonly COMMON_ATTRIBUTES = {\n [SEMATTRS_DB_SYSTEM]: DBSYSTEMVALUES_MYSQL,\n };\n\n constructor(config: MySQL2InstrumentationConfig = {}) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n }\n\n protected init() {\n let format: formatType | undefined;\n function setFormatFunction(moduleExports: any) {\n if (!format && moduleExports.format) {\n format = moduleExports.format;\n }\n }\n const patch = (ConnectionPrototype: mysqlTypes.Connection) => {\n if (isWrapped(ConnectionPrototype.query)) {\n this._unwrap(ConnectionPrototype, 'query');\n }\n this._wrap(\n ConnectionPrototype,\n 'query',\n this._patchQuery(format, false) as any\n );\n if (isWrapped(ConnectionPrototype.execute)) {\n this._unwrap(ConnectionPrototype, 'execute');\n }\n this._wrap(\n ConnectionPrototype,\n 'execute',\n this._patchQuery(format, true) as any\n );\n };\n const unpatch = (ConnectionPrototype: mysqlTypes.Connection) => {\n this._unwrap(ConnectionPrototype, 'query');\n this._unwrap(ConnectionPrototype, 'execute');\n };\n return [\n new InstrumentationNodeModuleDefinition(\n 'mysql2',\n supportedVersions,\n (moduleExports: any) => {\n setFormatFunction(moduleExports);\n return moduleExports;\n },\n () => {},\n [\n new InstrumentationNodeModuleFile(\n 'mysql2/promise.js',\n supportedVersions,\n (moduleExports: any) => {\n setFormatFunction(moduleExports);\n return moduleExports;\n },\n () => {}\n ),\n new InstrumentationNodeModuleFile(\n 'mysql2/lib/connection.js',\n supportedVersions,\n (moduleExports: any) => {\n const ConnectionPrototype: mysqlTypes.Connection =\n getConnectionPrototypeToInstrument(moduleExports);\n patch(ConnectionPrototype);\n return moduleExports;\n },\n (moduleExports: any) => {\n if (moduleExports === undefined) return;\n const ConnectionPrototype: mysqlTypes.Connection =\n getConnectionPrototypeToInstrument(moduleExports);\n unpatch(ConnectionPrototype);\n }\n ),\n ]\n ),\n ];\n }\n\n private _patchQuery(format: formatType | undefined, isPrepared: boolean) {\n return (originalQuery: Function): Function => {\n const thisPlugin = this;\n return function query(\n this: mysqlTypes.Connection,\n query: string | mysqlTypes.Query | mysqlTypes.QueryOptions,\n _valuesOrCallback?: unknown[] | Function,\n _callback?: Function\n ) {\n let values;\n if (Array.isArray(_valuesOrCallback)) {\n values = _valuesOrCallback;\n } else if (arguments[2]) {\n values = [_valuesOrCallback];\n }\n\n const span = thisPlugin.tracer.startSpan(getSpanName(query), {\n kind: api.SpanKind.CLIENT,\n attributes: {\n ...MySQL2Instrumentation.COMMON_ATTRIBUTES,\n ...getConnectionAttributes(this.config),\n [SEMATTRS_DB_STATEMENT]: getDbStatement(query, format, values),\n },\n });\n\n if (\n !isPrepared &&\n thisPlugin.getConfig().addSqlCommenterCommentToQueries\n ) {\n arguments[0] = query =\n typeof query === 'string'\n ? addSqlCommenterComment(span, query)\n : Object.assign(query, {\n sql: addSqlCommenterComment(span, query.sql),\n });\n }\n\n const endSpan = once((err?: any, results?: any) => {\n if (err) {\n span.setStatus({\n code: api.SpanStatusCode.ERROR,\n message: err.message,\n });\n } else {\n const { responseHook } = thisPlugin.getConfig();\n if (typeof responseHook === 'function') {\n safeExecuteInTheMiddle(\n () => {\n responseHook(span, {\n queryResults: results,\n });\n },\n err => {\n if (err) {\n thisPlugin._diag.warn('Failed executing responseHook', err);\n }\n },\n true\n );\n }\n }\n\n span.end();\n });\n\n if (arguments.length === 1) {\n if (typeof (query as any).onResult === 'function') {\n thisPlugin._wrap(\n query as any,\n 'onResult',\n thisPlugin._patchCallbackQuery(endSpan)\n );\n }\n\n const streamableQuery: mysqlTypes.Query = originalQuery.apply(\n this,\n arguments\n );\n\n // `end` in mysql behaves similarly to `result` in mysql2.\n streamableQuery\n .once('error', err => {\n endSpan(err);\n })\n .once('result', results => {\n endSpan(undefined, results);\n });\n\n return streamableQuery;\n }\n\n if (typeof arguments[1] === 'function') {\n thisPlugin._wrap(\n arguments,\n 1,\n thisPlugin._patchCallbackQuery(endSpan)\n );\n } else if (typeof arguments[2] === 'function') {\n thisPlugin._wrap(\n arguments,\n 2,\n thisPlugin._patchCallbackQuery(endSpan)\n );\n }\n\n return originalQuery.apply(this, arguments);\n };\n };\n }\n\n private _patchCallbackQuery(endSpan: Function) {\n return (originalCallback: Function) => {\n return function (\n err: mysqlTypes.QueryError | null,\n results?: any,\n fields?: mysqlTypes.FieldPacket[]\n ) {\n endSpan(err, results);\n return originalCallback(...arguments);\n };\n };\n }\n}\n"]} |