Skip to content

Commit 050b02f

Browse files
committed
fix case without parametrized route
1 parent 70ffadb commit 050b02f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/astro/src/server/middleware.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,14 @@ async function enhanceHttpServerSpan(
146146
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.astro',
147147
});
148148

149-
if (!parametrizedRoute) {
150-
return next();
151-
}
152-
153-
rootSpan.setAttributes({
154-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
155-
'http.route': parametrizedRoute,
156-
});
149+
if (parametrizedRoute) {
150+
rootSpan.setAttributes({
151+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
152+
'http.route': parametrizedRoute,
153+
});
157154

158-
isolationScope.setTransactionName(`${method} ${parametrizedRoute}`);
155+
isolationScope.setTransactionName(`${method} ${parametrizedRoute}`);
156+
}
159157

160158
try {
161159
const originalResponse = await next();

0 commit comments

Comments
 (0)