Skip to content

Commit

Permalink
make getModulePath ignore reflect metadata module (#150)
Browse files Browse the repository at this point in the history
* make getModulePath ignore reflect metadata module

* add comment clarifying need
  • Loading branch information
benjibuiltit authored Feb 26, 2024
1 parent 2d5e6e8 commit fd7a386
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/autometrics/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,15 @@ function getWrappedFunctionPath(): string | undefined {
return (
index > 2 &&
file &&
// Ignore autometrics internals
!file.includes("autometrics/index.cjs") &&
!file.includes("autometrics/index.mjs") &&
!file.includes("wrappers.ts") &&
!file.includes("wrappers.js")
!file.includes("wrappers.js") &&
// Ignore reflect-metadata - often used by IOC libraries for runtime dependency injection
// Without this, instrumented functions will be attributed to this module rather than
// the module the function truly belongs to
!file.includes("reflect-metadata")
);
});
return call?.file;
Expand Down

0 comments on commit fd7a386

Please sign in to comment.