@opentelemetry/instrumentation-redis-4
Advanced tools
Comparing version 0.38.0 to 0.39.0
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; | ||
import { RedisInstrumentationConfig } from './types'; | ||
export declare class RedisInstrumentation extends InstrumentationBase<any> { | ||
export declare class RedisInstrumentation extends InstrumentationBase { | ||
protected _config: RedisInstrumentationConfig; | ||
@@ -8,3 +8,3 @@ static readonly COMPONENT = "redis"; | ||
setConfig(config?: RedisInstrumentationConfig): void; | ||
protected init(): InstrumentationNodeModuleDefinition<any>[]; | ||
protected init(): InstrumentationNodeModuleDefinition[]; | ||
private _getInstrumentationNodeModuleDefinition; | ||
@@ -11,0 +11,0 @@ private _getPatchExtendWithCommands; |
@@ -61,3 +61,2 @@ "use strict"; | ||
// the function patches the commandExecutor to record a span | ||
this._diag.debug('Patching redis commands executor'); | ||
if ((0, instrumentation_1.isWrapped)(moduleExports === null || moduleExports === void 0 ? void 0 : moduleExports[functionToPatch])) { | ||
@@ -69,3 +68,2 @@ this._unwrap(moduleExports, functionToPatch); | ||
}, (moduleExports) => { | ||
this._diag.debug('Unpatching redis commands executor'); | ||
if ((0, instrumentation_1.isWrapped)(moduleExports === null || moduleExports === void 0 ? void 0 : moduleExports.extendWithCommands)) { | ||
@@ -80,3 +78,2 @@ this._unwrap(moduleExports, 'extendWithCommands'); | ||
var _a; | ||
this._diag.debug('Patching redis multi commands executor'); | ||
const redisClientMultiCommandPrototype = (_a = moduleExports === null || moduleExports === void 0 ? void 0 : moduleExports.default) === null || _a === void 0 ? void 0 : _a.prototype; | ||
@@ -94,3 +91,2 @@ if ((0, instrumentation_1.isWrapped)(redisClientMultiCommandPrototype === null || redisClientMultiCommandPrototype === void 0 ? void 0 : redisClientMultiCommandPrototype.exec)) { | ||
var _a; | ||
this._diag.debug('Unpatching redis multi commands executor'); | ||
const redisClientMultiCommandPrototype = (_a = moduleExports === null || moduleExports === void 0 ? void 0 : moduleExports.default) === null || _a === void 0 ? void 0 : _a.prototype; | ||
@@ -106,3 +102,2 @@ if ((0, instrumentation_1.isWrapped)(redisClientMultiCommandPrototype === null || redisClientMultiCommandPrototype === void 0 ? void 0 : redisClientMultiCommandPrototype.exec)) { | ||
var _a; | ||
this._diag.debug('Patching redis client'); | ||
const redisClientPrototype = (_a = moduleExports === null || moduleExports === void 0 ? void 0 : moduleExports.default) === null || _a === void 0 ? void 0 : _a.prototype; | ||
@@ -134,3 +129,2 @@ // In some @redis/client versions 'multi' is a method. In later | ||
var _a; | ||
this._diag.debug('Unpatching redis client'); | ||
const redisClientPrototype = (_a = moduleExports === null || moduleExports === void 0 ? void 0 : moduleExports.default) === null || _a === void 0 ? void 0 : _a.prototype; | ||
@@ -147,8 +141,5 @@ if ((0, instrumentation_1.isWrapped)(redisClientPrototype === null || redisClientPrototype === void 0 ? void 0 : redisClientPrototype.multi)) { | ||
}); | ||
return new instrumentation_1.InstrumentationNodeModuleDefinition(basePackageName, ['^1.0.0'], (moduleExports, moduleVersion) => { | ||
api_1.diag.debug(`Patching ${basePackageName}/client@${moduleVersion} (redis@^4.0.0)`); | ||
return new instrumentation_1.InstrumentationNodeModuleDefinition(basePackageName, ['^1.0.0'], (moduleExports) => { | ||
return moduleExports; | ||
}, (_moduleExports, moduleVersion) => { | ||
api_1.diag.debug(`Unpatching ${basePackageName}/client@${moduleVersion} (redis@^4.0.0)`); | ||
}, [commanderModuleFile, multiCommanderModule, clientIndexModule]); | ||
}, () => { }, [commanderModuleFile, multiCommanderModule, clientIndexModule]); | ||
} | ||
@@ -274,3 +265,3 @@ // serves both for redis 4.0.x where function name is extendWithCommands | ||
if (dbStatement != null) { | ||
attributes[semantic_conventions_1.SemanticAttributes.DB_STATEMENT] = dbStatement; | ||
attributes[semantic_conventions_1.SEMATTRS_DB_STATEMENT] = dbStatement; | ||
} | ||
@@ -277,0 +268,0 @@ } |
@@ -8,6 +8,6 @@ "use strict"; | ||
return { | ||
[semantic_conventions_1.SemanticAttributes.DB_SYSTEM]: semantic_conventions_1.DbSystemValues.REDIS, | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: (_a = options === null || options === void 0 ? void 0 : options.socket) === null || _a === void 0 ? void 0 : _a.host, | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_PORT]: (_b = options === null || options === void 0 ? void 0 : options.socket) === null || _b === void 0 ? void 0 : _b.port, | ||
[semantic_conventions_1.SemanticAttributes.DB_CONNECTION_STRING]: removeCredentialsFromDBConnectionStringAttribute(diag, options === null || options === void 0 ? void 0 : options.url), | ||
[semantic_conventions_1.SEMATTRS_DB_SYSTEM]: semantic_conventions_1.DBSYSTEMVALUES_REDIS, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_NAME]: (_a = options === null || options === void 0 ? void 0 : options.socket) === null || _a === void 0 ? void 0 : _a.host, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_PORT]: (_b = options === null || options === void 0 ? void 0 : options.socket) === null || _b === void 0 ? void 0 : _b.port, | ||
[semantic_conventions_1.SEMATTRS_DB_CONNECTION_STRING]: removeCredentialsFromDBConnectionStringAttribute(diag, options === null || options === void 0 ? void 0 : options.url), | ||
}; | ||
@@ -14,0 +14,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.38.0"; | ||
export declare const VERSION = "0.39.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.38.0'; | ||
exports.VERSION = '0.39.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-redis-4", | ||
"version": "0.38.0", | ||
"version": "0.39.0", | ||
"description": "Automatic OpenTelemetry instrumentation for redis package version 4", | ||
@@ -53,3 +53,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/core": "^1.8.0", | ||
@@ -70,8 +70,8 @@ "@opentelemetry/sdk-trace-base": "^1.8.0", | ||
"dependencies": { | ||
"@opentelemetry/instrumentation": "^0.50.0", | ||
"@opentelemetry/redis-common": "^0.36.1", | ||
"@opentelemetry/semantic-conventions": "^1.0.0" | ||
"@opentelemetry/instrumentation": "^0.51.0", | ||
"@opentelemetry/redis-common": "^0.36.2", | ||
"@opentelemetry/semantic-conventions": "^1.22.0" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-redis-4#readme", | ||
"gitHead": "17a0bc1da3baa472ba9b867eee3c60730cc130fb" | ||
"gitHead": "96a87b48934f0afcf1fe637eed6704f35bd8e973" | ||
} |
@@ -74,2 +74,16 @@ # OpenTelemetry redis 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 (without credentials). | | ||
| `db.statement` | The database statement being executed. | | ||
| `db.system` | An identifier for the database management system (DBMS) product being used. | | ||
| `net.peer.name` | Remote hostname or similar, see note below. | | ||
| `net.peer.port` | Remote port number. | | ||
## Useful links | ||
@@ -76,0 +90,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
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
103
81908
504
+ Added@opentelemetry/api-logs@0.51.1(transitive)
+ Added@opentelemetry/instrumentation@0.51.1(transitive)
+ Addedacorn-import-attributes@1.9.5(transitive)
+ Addedimport-in-the-middle@1.7.4(transitive)
- Removed@opentelemetry/api-logs@0.50.0(transitive)
- Removed@opentelemetry/instrumentation@0.50.0(transitive)
- Removedacorn-import-assertions@1.9.0(transitive)
- Removedimport-in-the-middle@1.7.1(transitive)