@opentelemetry/instrumentation-redis-4
Advanced tools
Comparing version 0.41.0 to 0.41.1
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; | ||
import { RedisInstrumentationConfig } from './types'; | ||
export declare class RedisInstrumentation extends InstrumentationBase { | ||
export declare class RedisInstrumentation extends InstrumentationBase<RedisInstrumentationConfig> { | ||
static readonly COMPONENT = "redis"; | ||
protected _config: RedisInstrumentationConfig; | ||
constructor(config?: RedisInstrumentationConfig); | ||
@@ -7,0 +6,0 @@ setConfig(config?: RedisInstrumentationConfig): void; |
@@ -32,6 +32,6 @@ "use strict"; | ||
constructor(config = {}) { | ||
super(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION, config); | ||
super(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION, Object.assign(Object.assign({}, DEFAULT_CONFIG), config)); | ||
} | ||
setConfig(config = {}) { | ||
this._config = Object.assign({}, DEFAULT_CONFIG, config); | ||
super.setConfig(Object.assign(Object.assign({}, DEFAULT_CONFIG), config)); | ||
} | ||
@@ -219,3 +219,3 @@ init() { | ||
const options = this.options; | ||
const attributes = (0, utils_1.getClientAttributes)(this._diag, options); | ||
const attributes = (0, utils_1.getClientAttributes)(plugin._diag, options); | ||
const span = plugin.tracer.startSpan(`${RedisInstrumentation.COMPONENT}-connect`, { | ||
@@ -246,5 +246,4 @@ kind: api_1.SpanKind.CLIENT, | ||
_traceClientCommand(origFunction, origThis, origArguments, redisCommandArguments) { | ||
var _a, _b; | ||
const hasNoParentSpan = api_1.trace.getSpan(api_1.context.active()) === undefined; | ||
if (hasNoParentSpan && ((_a = this._config) === null || _a === void 0 ? void 0 : _a.requireParentSpan)) { | ||
if (hasNoParentSpan && this.getConfig().requireParentSpan) { | ||
return origFunction.apply(origThis, origArguments); | ||
@@ -255,3 +254,3 @@ } | ||
const commandArgs = redisCommandArguments.slice(1); | ||
const dbStatementSerializer = ((_b = this._config) === null || _b === void 0 ? void 0 : _b.dbStatementSerializer) || redis_common_1.defaultDbStatementSerializer; | ||
const dbStatementSerializer = this.getConfig().dbStatementSerializer || redis_common_1.defaultDbStatementSerializer; | ||
const attributes = (0, utils_1.getClientAttributes)(this._diag, clientOptions); | ||
@@ -312,5 +311,6 @@ try { | ||
_endSpanWithResponse(span, commandName, commandArgs, response, error) { | ||
if (!error && this._config.responseHook) { | ||
const { responseHook } = this.getConfig(); | ||
if (!error && responseHook) { | ||
try { | ||
this._config.responseHook(span, commandName, commandArgs, response); | ||
responseHook(span, commandName, commandArgs, response); | ||
} | ||
@@ -317,0 +317,0 @@ catch (err) { |
@@ -1,3 +0,3 @@ | ||
export declare const PACKAGE_VERSION = "0.41.0"; | ||
export declare const PACKAGE_VERSION = "0.41.1"; | ||
export declare const PACKAGE_NAME = "@opentelemetry/instrumentation-redis-4"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,4 +20,4 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.PACKAGE_VERSION = '0.41.0'; | ||
exports.PACKAGE_VERSION = '0.41.1'; | ||
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-redis-4'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-redis-4", | ||
"version": "0.41.0", | ||
"version": "0.41.1", | ||
"description": "OpenTelemetry instrumentation for `redis` v4 database client for Redis", | ||
@@ -64,3 +64,3 @@ "main": "build/src/index.js", | ||
"redis": "4.1.0", | ||
"rimraf": "5.0.5", | ||
"rimraf": "5.0.10", | ||
"test-all-versions": "6.1.0", | ||
@@ -76,3 +76,3 @@ "ts-mocha": "10.0.0", | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-redis-4#readme", | ||
"gitHead": "ad8436d6a4174f2288cb939080cd4e74da94b0d7" | ||
"gitHead": "19454560b49b669c8f9c0cca9fcc3308b415f2b1" | ||
} |
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
82235
504