Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

/* eslint-disable @typescript-eslint/explicit-member-accessibility */
/* eslint-disable jsdoc/require-jsdoc */
/* eslint-disable max-lines */
/* eslint-disable no-param-reassign */
Expand All @@ -44,6 +43,7 @@ import {
ATTR_HTTP_ROUTE,
ATTR_SERVICE_NAME,
} from '@opentelemetry/semantic-conventions';
import { minimatch } from 'minimatch';

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

let globMatcher = null;
const globMatcher = minimatch;

this[kIgnorePaths] = routeOptions => {
if (typeof ignorePaths === 'function') {
return ignorePaths(routeOptions);
} else {
// Using minimatch to match the path until path.matchesGlob is out of experimental
// path.matchesGlob uses minimatch internally
if (globMatcher == null) {
globMatcher = require('minimatch').minimatch;
}

return globMatcher(routeOptions.url, ignorePaths);
}
};
Expand Down
Loading