Skip to content

Commit

Permalink
chore(pino): get rid of TODO (open-telemetry#739)
Browse files Browse the repository at this point in the history
* refactor: pino instrumentation: remove unnecessary _isEnabled

* fix: linting issues

* fix: lint
  • Loading branch information
seemk authored Nov 15, 2021
1 parent 12718e3 commit 29e4ab0
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -74,9 +71,6 @@ export class PinoInstrumentation extends InstrumentationBase {
}, pinoModule);

return patchedPino;
},
() => {
this._isEnabled = false;
}
),
];
Expand All @@ -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;

Expand All @@ -121,7 +105,7 @@ export class PinoInstrumentation extends InstrumentationBase {
private _getMixinFunction() {
const instrumentation = this;
return function otelMixin() {
if (!instrumentation._isEnabled) {
if (!instrumentation.isEnabled()) {
return {};
}

Expand Down

0 comments on commit 29e4ab0

Please sign in to comment.