Skip to content

Commit

Permalink
Update the name
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Sep 10, 2024
1 parent 8bd83d7 commit aa91899
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,15 +909,22 @@ export default abstract class Server<

const route = rootSpanAttributes.get('next.route')
if (route) {
const name = `${method} ${route}`
const name = isRSCRequest
? `${method} ${route} (partial render tree)`
: `${method} ${route}`

span.setAttributes({
'next.route': route,
'http.route': route,
'next.span_name': name,
})
span.updateName(name)
} else {
span.updateName(`${method} ${req.url}`)
span.updateName(
isRSCRequest
? `${method} ${req.url} (partial render tree)`
: `${method} ${req.url}`
)
}
})
)
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/opentelemetry/instrumentation/opentelemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,16 @@ describe('opentelemetry', () => {
runtime: 'nodejs',
traceId: env.span.traceId,
parentId: env.span.rootParentId,
name: 'GET /app/[param]/rsc-fetch',
name: 'GET /app/[param]/rsc-fetch (partial render tree)',
attributes: {
'http.method': 'GET',
'http.route': '/app/[param]/rsc-fetch',
'http.status_code': 200,
'http.target': '/app/param/rsc-fetch',
'next.route': '/app/[param]/rsc-fetch',
'next.rsc': true,
'next.span_name': 'GET /app/[param]/rsc-fetch',
'next.span_name':
'GET /app/[param]/rsc-fetch (partial render tree)',
'next.span_type': 'BaseServer.handleRequest',
},
kind: 1,
Expand Down

0 comments on commit aa91899

Please sign in to comment.