Skip to content

Commit d668714

Browse files
authored
fix(node): Avoid using dynamic require for fastify integration (#16789)
Not sure why we even have this, but this somehow breaks cloudflare-pages E2E tests in some scenarios. It also seems simply unnecessary - or is there a reason we have this? 🤔 Extracted this out from #16783
1 parent 3913754 commit d668714

File tree

1 file changed

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

1 file changed

+2
-8
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3030
SOFTWARE.
3131
*/
3232

33-
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
3433
/* eslint-disable jsdoc/require-jsdoc */
3534
/* eslint-disable max-lines */
3635
/* eslint-disable no-param-reassign */
@@ -44,6 +43,7 @@ import {
4443
ATTR_HTTP_ROUTE,
4544
ATTR_SERVICE_NAME,
4645
} from '@opentelemetry/semantic-conventions';
46+
import * as minimatch from 'minimatch';
4747

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

100-
let globMatcher = null;
100+
const globMatcher = minimatch.minimatch;
101101

102102
this[kIgnorePaths] = routeOptions => {
103103
if (typeof ignorePaths === 'function') {
104104
return ignorePaths(routeOptions);
105105
} 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-
112106
return globMatcher(routeOptions.url, ignorePaths);
113107
}
114108
};

0 commit comments

Comments
 (0)