Unverified Commit 2912b107 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

OTel: use `srcPage` for templates when `next.route` is unavailable (#83911)

### Why?

srcPage is relatively lower cardinality, so use this if available.

In the base-server handleRequest, it is the entry of the request, so no
low-cardinality target is available.


https://github.com/vercel/next.js/pull/75416/files#diff-6f4291cc2bfc5073fdca12a014011769e840ee68583db1468acef075f037015aR891
parent f2721210
...@@ -459,7 +459,7 @@ export async function handler( ...@@ -459,7 +459,7 @@ export async function handler(
}) })
span.updateName(name) span.updateName(name)
} else { } else {
span.updateName(`${method}`) span.updateName(`${method} ${srcPage}`)
} }
}) })
} }
...@@ -1393,7 +1393,7 @@ export async function handler( ...@@ -1393,7 +1393,7 @@ export async function handler(
tracer.trace( tracer.trace(
BaseServerSpan.handleRequest, BaseServerSpan.handleRequest,
{ {
spanName: `${method}`, spanName: `${method} ${srcPage}`,
kind: SpanKind.SERVER, kind: SpanKind.SERVER,
attributes: { attributes: {
'http.method': method, 'http.method': method,
......
...@@ -257,7 +257,7 @@ export async function handler( ...@@ -257,7 +257,7 @@ export async function handler(
}) })
span.updateName(name) span.updateName(name)
} else { } else {
span.updateName(`${method}`) span.updateName(`${method} ${srcPage}`)
} }
}) })
} }
...@@ -454,7 +454,7 @@ export async function handler( ...@@ -454,7 +454,7 @@ export async function handler(
tracer.trace( tracer.trace(
BaseServerSpan.handleRequest, BaseServerSpan.handleRequest,
{ {
spanName: `${method}`, spanName: `${method} ${srcPage}`,
kind: SpanKind.SERVER, kind: SpanKind.SERVER,
attributes: { attributes: {
'http.method': method, 'http.method': method,
......
...@@ -316,7 +316,7 @@ async function requestHandler( ...@@ -316,7 +316,7 @@ async function requestHandler(
}) })
span.updateName(name) span.updateName(name)
} else { } else {
span.updateName(`${req.method}`) span.updateName(`${req.method} ${srcPage}`)
} }
}) })
...@@ -339,7 +339,7 @@ async function requestHandler( ...@@ -339,7 +339,7 @@ async function requestHandler(
tracer.trace( tracer.trace(
BaseServerSpan.handleRequest, BaseServerSpan.handleRequest,
{ {
spanName: `${req.method}`, spanName: `${req.method} ${srcPage}`,
kind: SpanKind.SERVER, kind: SpanKind.SERVER,
attributes: { attributes: {
'http.method': req.method, 'http.method': req.method,
......
...@@ -296,7 +296,7 @@ async function requestHandler( ...@@ -296,7 +296,7 @@ async function requestHandler(
}) })
span.updateName(name) span.updateName(name)
} else { } else {
span.updateName(`${req.method}`) span.updateName(`${req.method} ${srcPage}`)
} }
}) })
...@@ -343,7 +343,7 @@ async function requestHandler( ...@@ -343,7 +343,7 @@ async function requestHandler(
tracer.trace( tracer.trace(
BaseServerSpan.handleRequest, BaseServerSpan.handleRequest,
{ {
spanName: `${req.method}`, spanName: `${req.method} ${srcPage}`,
kind: SpanKind.SERVER, kind: SpanKind.SERVER,
attributes: { attributes: {
'http.method': req.method, 'http.method': req.method,
......
...@@ -133,7 +133,7 @@ export async function handler( ...@@ -133,7 +133,7 @@ export async function handler(
}) })
span.updateName(name) span.updateName(name)
} else { } else {
span.updateName(`${method}`) span.updateName(`${method} ${srcPage}`)
} }
}) })
...@@ -146,7 +146,7 @@ export async function handler( ...@@ -146,7 +146,7 @@ export async function handler(
tracer.trace( tracer.trace(
BaseServerSpan.handleRequest, BaseServerSpan.handleRequest,
{ {
spanName: `${method}`, spanName: `${method} ${srcPage}`,
kind: SpanKind.SERVER, kind: SpanKind.SERVER,
attributes: { attributes: {
'http.method': method, 'http.method': method,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment