forked from open-telemetry/opentelemetry-js-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ioredis): fix instrumentation of ESM-imported ioredis
- With an ESM import the top-level object is a Module Namespace Object (https://tc39.es/ecma262/#sec-module-namespace-objects) that has no prototype. For compat, Node.js assigns the usual CommonJS module.exports to `<module>.default`, so use that when this is an ESM module. - Also, TypeScript translates class properties to assignments in the constructor after the super() call. Because super() can call init() and enable() synchronously, it calls back into 'IORedisInstrumentation' before 'traceSendCommand' was defined. Defining it as a method fixes that issue. Fixes: open-telemetry#1692
- Loading branch information
Showing
1 changed file
with
16 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters