Skip to content

Commit 2c69dde

Browse files
authored
Update otel test assertions and pages span_name (#84393)
This updates our otel tests to remove extra span assertions from `next start` with edge runtime that can cause confusion and fixes a couple span_names for pages handlers. x-ref: #75416 (comment)
1 parent bc2fa38 commit 2c69dde

File tree

3 files changed

+203
-285
lines changed

3 files changed

+203
-285
lines changed

packages/next/src/server/route-modules/pages/pages-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export const getHandler = ({
400400
})
401401
span.updateName(name)
402402
} else {
403-
span.updateName(`${method} ${req.url}`)
403+
span.updateName(`${method} ${srcPage}`)
404404
}
405405
})
406406
} catch (err: unknown) {
@@ -722,7 +722,7 @@ export const getHandler = ({
722722
tracer.trace(
723723
BaseServerSpan.handleRequest,
724724
{
725-
spanName: `${method} ${req.url}`,
725+
spanName: `${method} ${srcPage}`,
726726
kind: SpanKind.SERVER,
727727
attributes: {
728728
'http.method': method,

packages/next/src/server/web/adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export async function adapter(
252252
return getTracer().trace(
253253
MiddlewareSpan.execute,
254254
{
255-
spanName: `middleware ${request.method} ${request.nextUrl.pathname}`,
255+
spanName: `middleware ${request.method}`,
256256
attributes: {
257257
'http.target': request.nextUrl.pathname,
258258
'http.method': request.method,

0 commit comments

Comments
 (0)