Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/instrumentation-knex

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-knex - npm Package Compare versions

Comparing version 0.35.0 to 0.36.0

6

build/src/instrumentation.d.ts
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
import * as types from './types';
export declare class KnexInstrumentation extends InstrumentationBase<any> {
export declare class KnexInstrumentation extends InstrumentationBase {
constructor(config?: types.KnexInstrumentationConfig);
init(): InstrumentationNodeModuleDefinition<any>;
init(): InstrumentationNodeModuleDefinition;
private getRunnerNodeModuleFileInstrumentation;

@@ -10,4 +10,4 @@ private getClientNodeModuleFileInstrumentation;

private storeContext;
ensureWrapped(moduleVersion: string | undefined, obj: any, methodName: string, wrapper: (original: any) => any): void;
ensureWrapped(obj: any, methodName: string, wrapper: (original: any) => any): void;
}
//# sourceMappingURL=instrumentation.d.ts.map

@@ -40,7 +40,5 @@ "use strict";

return new instrumentation_1.InstrumentationNodeModuleFile(`knex/${basePath}/runner.js`, constants.SUPPORTED_VERSIONS, (Runner, moduleVersion) => {
api.diag.debug(`Applying ${basePath}/runner.js patch for ${constants.MODULE_NAME}@${moduleVersion}`);
this.ensureWrapped(moduleVersion, Runner.prototype, 'query', this.createQueryWrapper(moduleVersion));
this.ensureWrapped(Runner.prototype, 'query', this.createQueryWrapper(moduleVersion));
return Runner;
}, (Runner, moduleVersion) => {
api.diag.debug(`Removing ${basePath}/runner.js patch for ${constants.MODULE_NAME}@${moduleVersion}`);
this._unwrap(Runner.prototype, 'query');

@@ -51,7 +49,6 @@ return Runner;

getClientNodeModuleFileInstrumentation(basePath) {
return new instrumentation_1.InstrumentationNodeModuleFile(`knex/${basePath}/client.js`, constants.SUPPORTED_VERSIONS, (Client, moduleVersion) => {
api.diag.debug(`Applying ${basePath}/client.js patch for ${constants.MODULE_NAME}@${moduleVersion}`);
this.ensureWrapped(moduleVersion, Client.prototype, 'queryBuilder', this.storeContext.bind(this));
this.ensureWrapped(moduleVersion, Client.prototype, 'schemaBuilder', this.storeContext.bind(this));
this.ensureWrapped(moduleVersion, Client.prototype, 'raw', this.storeContext.bind(this));
return new instrumentation_1.InstrumentationNodeModuleFile(`knex/${basePath}/client.js`, constants.SUPPORTED_VERSIONS, (Client) => {
this.ensureWrapped(Client.prototype, 'queryBuilder', this.storeContext.bind(this));
this.ensureWrapped(Client.prototype, 'schemaBuilder', this.storeContext.bind(this));
this.ensureWrapped(Client.prototype, 'raw', this.storeContext.bind(this));
return Client;

@@ -80,13 +77,13 @@ }, (Client, moduleVersion) => {

'knex.version': moduleVersion,
[semantic_conventions_1.SemanticAttributes.DB_SYSTEM]: utils.mapSystem(config.client),
[semantic_conventions_1.SemanticAttributes.DB_SQL_TABLE]: table,
[semantic_conventions_1.SemanticAttributes.DB_OPERATION]: operation,
[semantic_conventions_1.SemanticAttributes.DB_USER]: (_c = config === null || config === void 0 ? void 0 : config.connection) === null || _c === void 0 ? void 0 : _c.user,
[semantic_conventions_1.SemanticAttributes.DB_NAME]: name,
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: (_d = config === null || config === void 0 ? void 0 : config.connection) === null || _d === void 0 ? void 0 : _d.host,
[semantic_conventions_1.SemanticAttributes.NET_PEER_PORT]: (_e = config === null || config === void 0 ? void 0 : config.connection) === null || _e === void 0 ? void 0 : _e.port,
[semantic_conventions_1.SemanticAttributes.NET_TRANSPORT]: ((_f = config === null || config === void 0 ? void 0 : config.connection) === null || _f === void 0 ? void 0 : _f.filename) === ':memory:' ? 'inproc' : undefined,
[semantic_conventions_1.SEMATTRS_DB_SYSTEM]: utils.mapSystem(config.client),
[semantic_conventions_1.SEMATTRS_DB_SQL_TABLE]: table,
[semantic_conventions_1.SEMATTRS_DB_OPERATION]: operation,
[semantic_conventions_1.SEMATTRS_DB_USER]: (_c = config === null || config === void 0 ? void 0 : config.connection) === null || _c === void 0 ? void 0 : _c.user,
[semantic_conventions_1.SEMATTRS_DB_NAME]: name,
[semantic_conventions_1.SEMATTRS_NET_PEER_NAME]: (_d = config === null || config === void 0 ? void 0 : config.connection) === null || _d === void 0 ? void 0 : _d.host,
[semantic_conventions_1.SEMATTRS_NET_PEER_PORT]: (_e = config === null || config === void 0 ? void 0 : config.connection) === null || _e === void 0 ? void 0 : _e.port,
[semantic_conventions_1.SEMATTRS_NET_TRANSPORT]: ((_f = config === null || config === void 0 ? void 0 : config.connection) === null || _f === void 0 ? void 0 : _f.filename) === ':memory:' ? 'inproc' : undefined,
};
if (maxLen !== 0) {
attributes[semantic_conventions_1.SemanticAttributes.DB_STATEMENT] = utils.limitLength(query === null || query === void 0 ? void 0 : query.sql, maxLen);
attributes[semantic_conventions_1.SEMATTRS_DB_STATEMENT] = utils.limitLength(query === null || query === void 0 ? void 0 : query.sql, maxLen);
}

@@ -131,4 +128,3 @@ const parent = this.builder[contextSymbol];

}
ensureWrapped(moduleVersion, obj, methodName, wrapper) {
api.diag.debug(`Applying ${methodName} patch for ${constants.MODULE_NAME}@${moduleVersion}`);
ensureWrapped(obj, methodName, wrapper) {
if ((0, instrumentation_1.isWrapped)(obj[methodName])) {

@@ -135,0 +131,0 @@ this._unwrap(obj, methodName);

@@ -49,4 +49,4 @@ "use strict";

const systemMap = new Map([
['sqlite3', semantic_conventions_1.DbSystemValues.SQLITE],
['pg', semantic_conventions_1.DbSystemValues.POSTGRESQL],
['sqlite3', semantic_conventions_1.DBSYSTEMVALUES_SQLITE],
['pg', semantic_conventions_1.DBSYSTEMVALUES_POSTGRESQL],
]);

@@ -53,0 +53,0 @@ const mapSystem = (knexSystem) => {

@@ -1,2 +0,2 @@

export declare const VERSION = "0.35.0";
export declare const VERSION = "0.36.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.35.0';
exports.VERSION = '0.36.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/instrumentation-knex",
"version": "0.35.0",
"version": "0.36.0",
"description": "OpenTelemetry Knex automatic instrumentation package",

@@ -60,7 +60,7 @@ "main": "build/src/index.js",

"dependencies": {
"@opentelemetry/instrumentation": "^0.50.0",
"@opentelemetry/semantic-conventions": "^1.0.0"
"@opentelemetry/instrumentation": "^0.51.0",
"@opentelemetry/semantic-conventions": "^1.22.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-knex#readme",
"gitHead": "17a0bc1da3baa472ba9b867eee3c60730cc130fb"
"gitHead": "96a87b48934f0afcf1fe637eed6704f35bd8e973"
}

@@ -51,2 +51,20 @@ # OpenTelemetry Knex Instrumentation for Node.js

## Semantic Conventions
This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)
Attributes collected:
| Attribute | Short Description |
| ----------------------- | ------------------------------------------------------------------------------ |
| `db.name` | This attribute is used to report the name of the database being accessed. |
| `db.operation` | The name of the operation being executed. |
| `db.sql.table` | The name of the primary table that the operation is acting upon. |
| `db.statement` | The database statement being executed. |
| `db.system` | An identifier for the database management system (DBMS) product being used. |
| `db.user` | Username for accessing the database. |
| `net.peer.name` | Remote hostname or similar. |
| `net.peer.port` | Remote port number. |
| `net.transport` | Transport protocol used. |
## Useful links

@@ -53,0 +71,0 @@

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc