diff --git a/plugins/node/opentelemetry-plugin-ioredis/src/ioredis.ts b/plugins/node/opentelemetry-plugin-ioredis/src/ioredis.ts index 92f6cef7814..675d5038538 100644 --- a/plugins/node/opentelemetry-plugin-ioredis/src/ioredis.ts +++ b/plugins/node/opentelemetry-plugin-ioredis/src/ioredis.ts @@ -15,7 +15,7 @@ */ import { BasePlugin } from '@opentelemetry/core'; -import * as ioredisTypes from 'ioredis'; +import type * as ioredisTypes from 'ioredis'; import * as shimmer from 'shimmer'; import { IoredisPluginConfig } from './types'; import { traceConnection, traceSendCommand } from './utils'; diff --git a/plugins/node/opentelemetry-plugin-ioredis/src/types.ts b/plugins/node/opentelemetry-plugin-ioredis/src/types.ts index b8226bc9b60..073e3897dc7 100644 --- a/plugins/node/opentelemetry-plugin-ioredis/src/types.ts +++ b/plugins/node/opentelemetry-plugin-ioredis/src/types.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as ioredisTypes from 'ioredis'; +import type * as ioredisTypes from 'ioredis'; import { PluginConfig } from '@opentelemetry/api'; export interface IoredisCommand { @@ -26,11 +26,6 @@ export interface IoredisCommand { name: string; } -export interface IoredisPluginClientTypes { - // https://github.com/luin/ioredis/blob/master/API.md - options: ioredisTypes.RedisOptions; -} - /** * Function that can be used to serialize db.statement tag * @param cmdName - The name of the command (eg. set, get, mset) diff --git a/plugins/node/opentelemetry-plugin-ioredis/src/utils.ts b/plugins/node/opentelemetry-plugin-ioredis/src/utils.ts index c452123568c..0eba5c90afd 100644 --- a/plugins/node/opentelemetry-plugin-ioredis/src/utils.ts +++ b/plugins/node/opentelemetry-plugin-ioredis/src/utils.ts @@ -14,10 +14,9 @@ * limitations under the License. */ -import * as ioredisTypes from 'ioredis'; +import type * as ioredisTypes from 'ioredis'; import { Tracer, SpanKind, Span, CanonicalCode } from '@opentelemetry/api'; import { - IoredisPluginClientTypes, IoredisCommand, IoredisPluginConfig, DbStatementSerializer, @@ -41,7 +40,7 @@ const endSpan = (span: Span, err: NodeJS.ErrnoException | null | undefined) => { }; export const traceConnection = (tracer: Tracer, original: Function) => { - return function (this: ioredisTypes.Redis & IoredisPluginClientTypes) { + return function (this: ioredisTypes.Redis) { const span = tracer.startSpan('connect', { kind: SpanKind.CLIENT, attributes: { @@ -82,10 +81,7 @@ export const traceSendCommand = ( ) => { const dbStatementSerializer = config?.dbStatementSerializer || defaultDbStatementSerializer; - return function ( - this: ioredisTypes.Redis & IoredisPluginClientTypes, - cmd?: IoredisCommand - ) { + return function (this: ioredisTypes.Redis, cmd?: IoredisCommand) { if (arguments.length < 1 || typeof cmd !== 'object') { return original.apply(this, arguments); }