vercel / otel

OTEL tracing for Vercel
https://vercel.com/docs/observability/otel-overview
40 stars 9 forks source link

Duplicate request traces for a single request #124

Open cbodin opened 2 months ago

cbodin commented 2 months ago

Each request to the Next.js application will send 2 traces. This seems to be related to the internal request routing as the operation.name differs and the first trace shows the actual path and the second trace shows the matched route.

E.g. in ApplicationInsights: image

For example, a catch-all page that triggers a notFound() will show the first trace as successful and the second (correctly) as unsuccessful.

Request properties: Attribute Trace 1 value Trace 2 value
Event time 9/18/2024, 2:40:09.999 PM (Local time) 9/18/2024, 2:40:10.117 PM (Local time)
Name GET /this-page-does-not-exist GET /[locale]/[[...slug]]
Response code 200 404
Successful request true false
Response time 61.3 ms 1.4 s
Custom properties: Attribute Trace 1 value Trace 2 value
next.span_name GET /this-page-does-not-exist GET /[locale]/[[...slug]]
next.span_type BaseServer.handleRequest BaseServer.handleRequest
http.target /this-page-does-not-exist /this-page-does-not-exist
next.rsc false false
next.route N/A /[locale]/[[...slug]]
next.bubble true N/A
operation.name next_js.BaseServer.handleRequest web.request
resource.name N/A GET /[locale]/[[...slug]]

Package Version
next 14.2.3
@vercel/otel 1.10.0
@opentelemetry/api 1.9.0
@azure/monitor-opentelemetry-exporter 1.0.0-beta.26
k-koleda commented 2 months ago

same for me. this thing is creating lots of noise in my case in Grafana Tempo