Skip to content

Commit 90470c6

Browse files
committed
avoid unnecessary require
1 parent 5001483 commit 90470c6

File tree

1 file changed

+2
-7
lines changed
  • packages/node/src/integrations/tracing/fastify/fastify-otel

1 file changed

+2
-7
lines changed

packages/node/src/integrations/tracing/fastify/fastify-otel/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
ATTR_HTTP_ROUTE,
4545
ATTR_SERVICE_NAME,
4646
} from '@opentelemetry/semantic-conventions';
47+
import * as minimatch from 'minimatch';
4748

4849
// SENTRY VENDOR NOTE
4950
// Instead of using the package.json file, we hard code the package name and version here.
@@ -97,18 +98,12 @@ export class FastifyOtelInstrumentation extends InstrumentationBase {
9798
throw new TypeError('ignorePaths must be a string or a function');
9899
}
99100

100-
let globMatcher = null;
101+
const globMatcher = minimatch.minimatch;
101102

102103
this[kIgnorePaths] = routeOptions => {
103104
if (typeof ignorePaths === 'function') {
104105
return ignorePaths(routeOptions);
105106
} else {
106-
// Using minimatch to match the path until path.matchesGlob is out of experimental
107-
// path.matchesGlob uses minimatch internally
108-
if (globMatcher == null) {
109-
globMatcher = require('minimatch').minimatch;
110-
}
111-
112107
return globMatcher(routeOptions.url, ignorePaths);
113108
}
114109
};

0 commit comments

Comments
 (0)