diff --git a/plugins/node/opentelemetry-instrumentation-redis/src/internal-types.ts b/plugins/node/opentelemetry-instrumentation-redis/src/internal-types.ts index 99e2efe829..545a1927e4 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/src/internal-types.ts +++ b/plugins/node/opentelemetry-instrumentation-redis/src/internal-types.ts @@ -14,9 +14,9 @@ * limitations under the License. */ export interface RedisPluginClientTypes { - options?: { - host: string; - port: string; + connection_options?: { + port?: string; + host?: string; }; address?: string; diff --git a/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts b/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts index fed4f769f9..d863089f30 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts @@ -111,10 +111,10 @@ export const getTracedInternalSendCommand = ( ); // Set attributes for not explicitly typed RedisPluginClientTypes - if (this.options) { + if (this.connection_options) { span.setAttributes({ - [SEMATTRS_NET_PEER_NAME]: this.options.host, - [SEMATTRS_NET_PEER_PORT]: this.options.port, + [SEMATTRS_NET_PEER_NAME]: this.connection_options.host, + [SEMATTRS_NET_PEER_PORT]: this.connection_options.port, }); } if (this.address) { diff --git a/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts b/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts index 63ab337e86..13113a2f3d 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts +++ b/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts @@ -51,7 +51,7 @@ const memoryExporter = new InMemorySpanExporter(); const CONFIG = { host: process.env.OPENTELEMETRY_REDIS_HOST || 'localhost', - port: process.env.OPENTELEMETRY_REDIS_PORT || '63790', + port: Number(process.env.OPENTELEMETRY_REDIS_PORT || 63790), }; const URL = `redis://${CONFIG.host}:${CONFIG.port}`;