@opentelemetry/instrumentation-mysql2
Advanced tools
Comparing version 0.43.0 to 0.44.0
@@ -33,3 +33,3 @@ "use strict"; | ||
new instrumentation_1.InstrumentationNodeModuleDefinition('mysql2', ['>=1.4.2 <4'], (moduleExports) => { | ||
const ConnectionPrototype = moduleExports.Connection.prototype; | ||
const ConnectionPrototype = (0, utils_1.getConnectionPrototypeToInstrument)(moduleExports.Connection); | ||
if ((0, instrumentation_1.isWrapped)(ConnectionPrototype.query)) { | ||
@@ -36,0 +36,0 @@ this._unwrap(ConnectionPrototype, 'query'); |
@@ -38,3 +38,4 @@ import { Attributes } from '@opentelemetry/api'; | ||
export declare const once: (fn: Function) => (...args: unknown[]) => any; | ||
export declare function getConnectionPrototypeToInstrument(connection: any): any; | ||
export {}; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.once = exports.getSpanName = exports.getDbStatement = exports.getConnectionAttributes = void 0; | ||
exports.getConnectionPrototypeToInstrument = exports.once = exports.getSpanName = exports.getDbStatement = exports.getConnectionAttributes = void 0; | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
@@ -104,2 +104,17 @@ /** | ||
exports.once = once; | ||
function getConnectionPrototypeToInstrument(connection) { | ||
const connectionPrototype = connection.prototype; | ||
const basePrototype = Object.getPrototypeOf(connectionPrototype); | ||
// mysql2@3.11.5 included a refactoring, where most code was moved out of the `Connection` class and into a shared base | ||
// so we need to instrument that instead, see https://github.com/sidorares/node-mysql2/pull/3081 | ||
// This checks if the functions we're instrumenting are there on the base - we cannot use the presence of a base | ||
// prototype since EventEmitter is the base for mysql2@<=3.11.4 | ||
if (typeof (basePrototype === null || basePrototype === void 0 ? void 0 : basePrototype.query) === 'function' && | ||
typeof (basePrototype === null || basePrototype === void 0 ? void 0 : basePrototype.execute) === 'function') { | ||
return basePrototype; | ||
} | ||
// otherwise instrument the connection directly. | ||
return connectionPrototype; | ||
} | ||
exports.getConnectionPrototypeToInstrument = getConnectionPrototypeToInstrument; | ||
//# sourceMappingURL=utils.js.map |
@@ -1,3 +0,3 @@ | ||
export declare const PACKAGE_VERSION = "0.43.0"; | ||
export declare const PACKAGE_VERSION = "0.44.0"; | ||
export declare const PACKAGE_NAME = "@opentelemetry/instrumentation-mysql2"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,4 +20,4 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.PACKAGE_VERSION = '0.43.0'; | ||
exports.PACKAGE_VERSION = '0.44.0'; | ||
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-mysql2'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-mysql2", | ||
"version": "0.43.0", | ||
"version": "0.44.0", | ||
"description": "OpenTelemetry instrumentation for `mysql2` database client for MySQL", | ||
@@ -48,3 +48,3 @@ "main": "build/src/index.js", | ||
"@opentelemetry/context-async-hooks": "^1.8.0", | ||
"@opentelemetry/contrib-test-utils": "^0.43.0", | ||
"@opentelemetry/contrib-test-utils": "^0.44.0", | ||
"@opentelemetry/sdk-trace-base": "^1.8.0", | ||
@@ -54,3 +54,3 @@ "@types/mocha": "7.0.2", | ||
"@types/semver": "7.5.8", | ||
"mysql2": "3.11.3", | ||
"mysql2": "3.11.5", | ||
"nyc": "15.1.0", | ||
@@ -63,3 +63,3 @@ "rimraf": "5.0.10", | ||
"dependencies": { | ||
"@opentelemetry/instrumentation": "^0.55.0", | ||
"@opentelemetry/instrumentation": "^0.56.0", | ||
"@opentelemetry/semantic-conventions": "^1.27.0", | ||
@@ -69,3 +69,3 @@ "@opentelemetry/sql-common": "^0.40.1" | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mysql2#readme", | ||
"gitHead": "d0fb13557fac651424b095b0a48a5116407875b1" | ||
"gitHead": "e3c9150445e13c5aa4c2c4d981bb2193e0076e50" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57847
396
+ Added@opentelemetry/api-logs@0.56.0(transitive)
+ Added@opentelemetry/instrumentation@0.56.0(transitive)
- Removed@opentelemetry/api-logs@0.55.0(transitive)
- Removed@opentelemetry/instrumentation@0.55.0(transitive)