Skip to content

Commit 5167f11

Browse files
committed
fix(server): collapse sentry metrics for OPTIONS and HEAD requests
1 parent 7d973d7 commit 5167f11

File tree

1 file changed

+7
-2
lines changed
  • packages/server/src/middleware

1 file changed

+7
-2
lines changed

packages/server/src/middleware/log.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,15 @@ export function logMiddleware(app, options) {
9292
}
9393

9494
if (_compasSentryExport) {
95-
if (_compasSentryExport?.metrics?.increment) {
95+
if (_compasSentryExport.metrics?.increment) {
96+
let compasRouteName = ctx.event.name;
97+
if (!compasRouteName.startsWith("router.")) {
98+
compasRouteName = "<unmatched>";
99+
}
100+
96101
_compasSentryExport.metrics.increment("compas.route.name", 1, {
97102
tags: {
98-
compasRouteName: ctx.event.name ?? "<unmatched>",
103+
compasRouteName,
99104
},
100105
unit: "none",
101106
});

0 commit comments

Comments
 (0)