Socket
Socket
Sign inDemoInstall

@opentelemetry/instrumentation-mysql2

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-mysql2 - npm Package Compare versions

Comparing version 0.37.0 to 0.38.0

6

build/src/instrumentation.d.ts
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
import { MySQL2InstrumentationConfig } from './types';
export declare class MySQL2Instrumentation extends InstrumentationBase<any> {
export declare class MySQL2Instrumentation extends InstrumentationBase {
static readonly COMMON_ATTRIBUTES: {
"db.system": "mysql";
"db.system": string;
};
constructor(config?: MySQL2InstrumentationConfig);
protected init(): InstrumentationNodeModuleDefinition<any>[];
protected init(): InstrumentationNodeModuleDefinition[];
private _patchQuery;

@@ -10,0 +10,0 @@ private _patchCallbackQuery;

@@ -31,4 +31,3 @@ "use strict";

return [
new instrumentation_1.InstrumentationNodeModuleDefinition('mysql2', ['>= 1.4.2 < 4.0'], (moduleExports, moduleVersion) => {
api.diag.debug(`Patching mysql2@${moduleVersion}`);
new instrumentation_1.InstrumentationNodeModuleDefinition('mysql2', ['>= 1.4.2 < 4.0'], (moduleExports) => {
const ConnectionPrototype = moduleExports.Connection.prototype;

@@ -69,3 +68,3 @@ api.diag.debug('Patching Connection.prototype.query');

kind: api.SpanKind.CLIENT,
attributes: Object.assign(Object.assign(Object.assign({}, MySQL2Instrumentation.COMMON_ATTRIBUTES), (0, utils_1.getConnectionAttributes)(this.config)), { [semantic_conventions_1.SemanticAttributes.DB_STATEMENT]: (0, utils_1.getDbStatement)(query, format, values) }),
attributes: Object.assign(Object.assign(Object.assign({}, MySQL2Instrumentation.COMMON_ATTRIBUTES), (0, utils_1.getConnectionAttributes)(this.config)), { [semantic_conventions_1.SEMATTRS_DB_STATEMENT]: (0, utils_1.getDbStatement)(query, format, values) }),
});

@@ -138,4 +137,4 @@ if (!isPrepared && thisPluginConfig.addSqlCommenterCommentToQueries) {

MySQL2Instrumentation.COMMON_ATTRIBUTES = {
[semantic_conventions_1.SemanticAttributes.DB_SYSTEM]: semantic_conventions_1.DbSystemValues.MYSQL,
[semantic_conventions_1.SEMATTRS_DB_SYSTEM]: semantic_conventions_1.DBSYSTEMVALUES_MYSQL,
};
//# sourceMappingURL=instrumentation.js.map

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

import { SpanAttributes } from '@opentelemetry/api';
import { Attributes } from '@opentelemetry/api';
interface QueryOptions {

@@ -19,7 +19,7 @@ sql: string;

/**
* Get an SpanAttributes map from a mysql connection config object
* Get an Attributes map from a mysql connection config object
*
* @param config ConnectionConfig
*/
export declare function getConnectionAttributes(config: Config): SpanAttributes;
export declare function getConnectionAttributes(config: Config): Attributes;
/**

@@ -26,0 +26,0 @@ * Conjures up the value for the db.statement attribute by formatting a SQL query.

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

/**
* Get an SpanAttributes map from a mysql connection config object
* Get an Attributes map from a mysql connection config object
*

@@ -31,14 +31,14 @@ * @param config ConnectionConfig

return {
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: host,
[semantic_conventions_1.SemanticAttributes.NET_PEER_PORT]: portNumber,
[semantic_conventions_1.SemanticAttributes.DB_CONNECTION_STRING]: getJDBCString(host, port, database),
[semantic_conventions_1.SemanticAttributes.DB_NAME]: database,
[semantic_conventions_1.SemanticAttributes.DB_USER]: user,
[semantic_conventions_1.SEMATTRS_NET_PEER_NAME]: host,
[semantic_conventions_1.SEMATTRS_NET_PEER_PORT]: portNumber,
[semantic_conventions_1.SEMATTRS_DB_CONNECTION_STRING]: getJDBCString(host, port, database),
[semantic_conventions_1.SEMATTRS_DB_NAME]: database,
[semantic_conventions_1.SEMATTRS_DB_USER]: user,
};
}
return {
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: host,
[semantic_conventions_1.SemanticAttributes.DB_CONNECTION_STRING]: getJDBCString(host, port, database),
[semantic_conventions_1.SemanticAttributes.DB_NAME]: database,
[semantic_conventions_1.SemanticAttributes.DB_USER]: user,
[semantic_conventions_1.SEMATTRS_NET_PEER_NAME]: host,
[semantic_conventions_1.SEMATTRS_DB_CONNECTION_STRING]: getJDBCString(host, port, database),
[semantic_conventions_1.SEMATTRS_DB_NAME]: database,
[semantic_conventions_1.SEMATTRS_DB_USER]: user,
};

@@ -45,0 +45,0 @@ }

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

export declare const VERSION = "0.37.0";
export declare const VERSION = "0.38.0";
//# sourceMappingURL=version.d.ts.map

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

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

@@ -49,3 +49,3 @@ "main": "build/src/index.js",

"@opentelemetry/context-async-hooks": "^1.8.0",
"@opentelemetry/contrib-test-utils": "^0.38.0",
"@opentelemetry/contrib-test-utils": "^0.39.0",
"@opentelemetry/sdk-trace-base": "^1.8.0",

@@ -65,8 +65,8 @@ "@types/mocha": "7.0.2",

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

@@ -52,2 +52,18 @@ # OpenTelemetry mysql 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.connection_string` | The connection string used to connect to the database. |
| `db.name` | This attribute is used to report the name of the database being accessed. |
| `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. |
## Useful links

@@ -54,0 +70,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