Skip to content

Commit 5b2c10b

Browse files
committed
chore: add v prefix when using multiple versions
1 parent 1ec39b4 commit 5b2c10b

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

plugins/node/opentelemetry-instrumentation-redis/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test": "npm run test-v2-v3 && npm run test-v4",
1010
"test-v2-v3": "tav redis 3.1.2 npm run test-v2-v3-run",
1111
"test-v4": "tav redis 4.7.1 npm run test-v4-run",
12-
"test-v2-v3-run": "nyc mocha --no-clean --require '@opentelemetry/contrib-test-utils' 'test/v2-3/*.test.ts'",
12+
"test-v2-v3-run": "nyc mocha --no-clean --require '@opentelemetry/contrib-test-utils' 'test/v2-v3/*.test.ts'",
1313
"test-v4-run": "nyc mocha --no-clean --require '@opentelemetry/contrib-test-utils' 'test/v4/*.test.ts'",
1414
"test:debug": "cross-env RUN_REDIS_TESTS_LOCAL=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
1515
"test:local": "cross-env RUN_REDIS_TESTS_LOCAL=true npm run test",

plugins/node/opentelemetry-instrumentation-redis/src/instrumentation.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { InstrumentationBase } from '@opentelemetry/instrumentation';
1717
import { RedisInstrumentationConfig } from './types';
1818
/** @knipignore */
1919
import { PACKAGE_NAME, PACKAGE_VERSION } from './version';
20-
import { RedisInstrumentationV2_3 } from './v2-3/instrumentation';
20+
import { RedisInstrumentationV2_V3 } from './v2-v3/instrumentation';
2121
import { TracerProvider } from '@opentelemetry/api';
2222
import { RedisInstrumentationV4 } from './v4/instrumentation';
2323

@@ -27,7 +27,7 @@ const DEFAULT_CONFIG: RedisInstrumentationConfig = {
2727

2828
// Wrapper RedisInstrumentation that address all supported versions
2929
export class RedisInstrumentation extends InstrumentationBase<RedisInstrumentationConfig> {
30-
private instrumentationV2_3: RedisInstrumentationV2_3;
30+
private instrumentationV2_V3: RedisInstrumentationV2_V3;
3131
private instrumentationV4: RedisInstrumentationV4;
3232

3333
// this is used to bypass a flaw in the base class constructor, which is calling
@@ -38,7 +38,7 @@ export class RedisInstrumentation extends InstrumentationBase<RedisInstrumentati
3838
const resolvedConfig = { ...DEFAULT_CONFIG, ...config };
3939
super(PACKAGE_NAME, PACKAGE_VERSION, resolvedConfig);
4040

41-
this.instrumentationV2_3 = new RedisInstrumentationV2_3(this.getConfig());
41+
this.instrumentationV2_V3 = new RedisInstrumentationV2_V3(this.getConfig());
4242
this.instrumentationV4 = new RedisInstrumentationV4(this.getConfig());
4343
this.initialized = true;
4444
}
@@ -50,7 +50,7 @@ export class RedisInstrumentation extends InstrumentationBase<RedisInstrumentati
5050
return;
5151
}
5252

53-
this.instrumentationV2_3.setConfig(newConfig);
53+
this.instrumentationV2_V3.setConfig(newConfig);
5454
this.instrumentationV4.setConfig(newConfig);
5555
}
5656

@@ -61,7 +61,7 @@ export class RedisInstrumentation extends InstrumentationBase<RedisInstrumentati
6161
if (!this.initialized) {
6262
return;
6363
}
64-
this.instrumentationV2_3.setTracerProvider(tracerProvider);
64+
this.instrumentationV2_V3.setTracerProvider(tracerProvider);
6565
this.instrumentationV4.setTracerProvider(tracerProvider);
6666
}
6767

@@ -70,7 +70,7 @@ export class RedisInstrumentation extends InstrumentationBase<RedisInstrumentati
7070
if (!this.initialized) {
7171
return;
7272
}
73-
this.instrumentationV2_3.enable();
73+
this.instrumentationV2_V3.enable();
7474
this.instrumentationV4.enable();
7575
}
7676

@@ -79,7 +79,7 @@ export class RedisInstrumentation extends InstrumentationBase<RedisInstrumentati
7979
if (!this.initialized) {
8080
return;
8181
}
82-
this.instrumentationV2_3.disable();
82+
this.instrumentationV2_V3.disable();
8383
this.instrumentationV4.disable();
8484
}
8585
}

plugins/node/opentelemetry-instrumentation-redis/src/v2-3/instrumentation.ts renamed to plugins/node/opentelemetry-instrumentation-redis/src/v2-v3/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
} from '@opentelemetry/semantic-conventions';
4141
import { defaultDbStatementSerializer } from '@opentelemetry/redis-common';
4242

43-
export class RedisInstrumentationV2_3 extends InstrumentationBase<RedisInstrumentationConfig> {
43+
export class RedisInstrumentationV2_V3 extends InstrumentationBase<RedisInstrumentationConfig> {
4444
static readonly COMPONENT = 'redis';
4545

4646
constructor(config: RedisInstrumentationConfig = {}) {
@@ -128,7 +128,7 @@ export class RedisInstrumentationV2_3 extends InstrumentationBase<RedisInstrumen
128128
const dbStatementSerializer =
129129
config?.dbStatementSerializer || defaultDbStatementSerializer;
130130
const span = instrumentation.tracer.startSpan(
131-
`${RedisInstrumentationV2_3.COMPONENT}-${cmd.command}`,
131+
`${RedisInstrumentationV2_V3.COMPONENT}-${cmd.command}`,
132132
{
133133
kind: SpanKind.CLIENT,
134134
attributes: {

0 commit comments

Comments
 (0)