From f078ae5e5d28781b5e23976dc832365426b52d2c Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 21 Apr 2021 10:19:45 +0300 Subject: [PATCH 1/2] fix: change _enabled to protected at instrumentationbase --- .../src/platform/node/instrumentation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index e31476a369b..dab38194adc 100644 --- a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -30,7 +30,7 @@ export abstract class InstrumentationBase implements types.Instrumentation { private _modules: InstrumentationModuleDefinition[]; private _hooks: RequireInTheMiddle.Hooked[] = []; - private _enabled = false; + protected _enabled = false; constructor( instrumentationName: string, From 5d8412512acc0e962660aead9c3e0f865599f74c Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 21 Apr 2021 12:14:34 +0300 Subject: [PATCH 2/2] refactor: use isEnabled --- .../src/platform/node/instrumentation.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index dab38194adc..98900383ff3 100644 --- a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -30,7 +30,7 @@ export abstract class InstrumentationBase implements types.Instrumentation { private _modules: InstrumentationModuleDefinition[]; private _hooks: RequireInTheMiddle.Hooked[] = []; - protected _enabled = false; + private _enabled = false; constructor( instrumentationName: string, @@ -160,6 +160,10 @@ export abstract class InstrumentationBase } } } + + public isEnabled() { + return this._enabled; + } } function isSupported(supportedVersions: string[], version: string): boolean {