Tracing: add opt-in flag to send a subset of development traces to url (#53880)
This adds an **opt-in** feature to send a subset of trace spans and metadata to a remote http server. The url must be provided as an option like so: `next dev --experimental-upload-trace=http://localhost:3000/traces` These traces are derived from the tracing data stored at `.next/trace`. The request payload looks like this: ```json { "metadata": { "commit": "69b0a3366734182f4efce6c0089c2592044d7124", "mode": "dev", "pkgName": "nextjs-project", "arch": "arm64", "cpus": 10, "platform": "darwin" }, "traces": [ [ { "traceId": "2f041a20b06027ab", "name": "hot-reloader", "id": 1, "timestamp": 28712742599, "duration": 21, "tags": { "version": "13.4.14-canary.1" }, "startTime": 1691707223226 }, { "traceId": "2f041a20b06027ab", "parentId": 1, "name": "webpack-invalidated-server", "id": 63, "timestamp": 28713776446, "duration": 244628, "tags": { "trigger": "manual" }, "startTime": 1691707224260 }, { "traceId": "2f041a20b06027ab", "parentId": 1, "name": "webpack-invalidated-server", "id": 111, "timestamp": 28714080210, "duration": 115267, "tags": { "trigger": "manual" }, "startTime": 1691707224563 }, { "traceId": "2f041a20b06027ab", "parentId": 1, "name": "webpack-invalidated-server", "id": 168, "timestamp": 28715243617, "duration": 69471, "tags": { "trigger": "[project]/pages/index.tsx" }, "startTime": 1691707225727 }, { "traceId": "2f041a20b06027ab", "parentId": 1, "name": "client-hmr-latency", "id": 222, "timestamp": 1691707225727000, "duration": 72000, "tags": { "clientId": 1691707224946 }, "startTime": 1691707225799 }, { "traceId": "2f041a20b06027ab", "parentId": 1, "name": "webpack-invalidated-server", "id": 223, "timestamp": 28716999898, "duration": 47425, "tags": { "trigger": "[project]/pages/index.tsx" }, "startTime": 1691707227483 } ] ] } ``` Currently only events of type `client-hmr-latency`, `hot-reloader`, `webpack-invalid-client`, `webpack-invalidated-server` are included, as well as all root spans. Traces are expected to include the ancestry of any given span through the `parentId` property.
Showing
Please
register
or
sign in
to comment