From 29e4ab0e967b714e9887b3d9bb5839443db9448c Mon Sep 17 00:00:00 2001
From: Siim Kallas <siimkallas@gmail.com>
Date: Mon, 15 Nov 2021 21:02:39 +0200
Subject: [PATCH] chore(pino): get rid of TODO (#739)

* refactor: pino instrumentation: remove unnecessary _isEnabled

* fix: linting issues

* fix: lint
---
 .../src/instrumentation.ts                     | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts
index 292c9b3fa5..75488c2137 100644
--- a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts
+++ b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts
@@ -33,9 +33,6 @@ import type * as pino from 'pino';
 const pinoVersions = ['>=5.14.0 <7'];
 
 export class PinoInstrumentation extends InstrumentationBase {
-  // TODO: https://github.com/open-telemetry/opentelemetry-js/issues/2131
-  _isEnabled: boolean = false;
-
   constructor(config: PinoInstrumentationConfig = {}) {
     super('@opentelemetry/instrumentation-pino', VERSION, config);
   }
@@ -74,9 +71,6 @@ export class PinoInstrumentation extends InstrumentationBase {
           }, pinoModule);
 
           return patchedPino;
-        },
-        () => {
-          this._isEnabled = false;
         }
       ),
     ];
@@ -90,16 +84,6 @@ export class PinoInstrumentation extends InstrumentationBase {
     this._config = config;
   }
 
-  override enable() {
-    super.enable();
-    this._isEnabled = true;
-  }
-
-  override disable() {
-    super.disable();
-    this._isEnabled = false;
-  }
-
   private _callHook(span: Span, record: Record<string, string>) {
     const hook = this.getConfig().logHook;
 
@@ -121,7 +105,7 @@ export class PinoInstrumentation extends InstrumentationBase {
   private _getMixinFunction() {
     const instrumentation = this;
     return function otelMixin() {
-      if (!instrumentation._isEnabled) {
+      if (!instrumentation.isEnabled()) {
         return {};
       }