46201e1644
Adds bunch of default attributes and span names as discussed in https://github.com/vercel/next.js/pull/47066 Also discovered a few issues with our test setup. It's actually quite handy to use jest snapshots for this, thanks for the tip @feedthejim Currently we have following spans: - root span with name `GET /app/rsc-fetch` (both API calls and page requests) - `SERVER` span - attributes: - `"http.method": "GET"` - `"http.status_code": 200` - `"http.target": "/app/rsc-fetch"` - `"next.span_name": "GET /app/rsc-fetch"` - `"next.span_type": "BaseServer.handleRequest"` - fetch span `fetch GET https://vercel.com/` - `CLIENT` span - attributes: - `"http.method": "GET"` - `"http.url": "https://vercel.com/"` - `"net.peer.name": "vercel.com"` - `"next.span_name": "fetch GET https://vercel.com/"` - `"next.span_type": "AppRender.fetch"` - rendering of page `rendering /app/rsc-fetch` - attributes: - `"next.pathname": "/app/rsc-fetch"` - `"next.span_name": "rendering /app/rsc-fetch"` - `"next.span_type": "BaseServer.renderToResponse"` - finding the right page component `resolving route /app/rsc-fetch/page` - attributes - `"next.route": "/app/rsc-fetch/page"` - `"next.span_name": "resolving route /app/rsc-fetch/page"` - `"next.span_type": "NextNodeServer.findPageComponents"` - getServerSideProps `getServerSideProps /pages/getServerSideProps` - attributes - `"next.span_name": "getServerSideProps /pages/getServerSideProps"` - `"next.span_type": "Render.getServerSideProps"` fix NEXT-829 ([link](https://linear.app/vercel/issue/NEXT-829))
18 lines
348 B
TypeScript
18 lines
348 B
TypeScript
import { SpanKind } from '@opentelemetry/api'
|
|
|
|
export const traceFile = 'otel-trace.txt'
|
|
|
|
export type SavedSpan = {
|
|
traceId?: string
|
|
parentId?: string
|
|
traceState?: any
|
|
name?: string
|
|
id?: string
|
|
kind?: SpanKind
|
|
timestamp?: number
|
|
duration?: number
|
|
attributes?: Record<string, any>
|
|
status?: any
|
|
events?: any[]
|
|
links?: any[]
|
|
}
|