Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Telemetry-compatible tracing (#22713)
A number of changes here. I recommend viewing the diff with the <a href="?w=1">whitespace flag enabled</a>. - OpenTelemetry is replaced with a custom and lightweight tracing solution. - Three trace targets are currently supported: console, Zipkin, and NextJS. - Tracing is now governed by environment variables rather than `--require instrument.js`. + `TRACE_TARGET`: one of `CONSOLE`, `ZIPKIN`, or `TELEMETRY`; defaults to `TELEMETRY` if unset or invalid. + `TRACE_ID`: an 8-byte hex-encoded value used as the Zipkin trace ID; if not provided, this value will be randomly generated and passed down to subprocesses. Other sundry: - I'm missing something, probably a setup step, with the Zipkin target. Traces are captured successfully, but you have to manually enter the Trace ID in order to view the trace - it doesn't show up in queries. - I'm generally unhappy with [this commit](235cedc). It is... untidy to provide a telemetry object via `setGlobal`, but I don't have a ready alternative. Is `distDir` strictly required when creating a new Telemetry object? I didn't dig too deep here. As noted, there are a lot of changes, so it'd be great if a reviewer could: - [ ] pull down the branch and try to break it - [ ] check the Zipkin traces and identify possible regressions in the functionality Closes #22570 Fixes #22574
- Loading branch information
Showing
with
1,534 additions
and 1,579 deletions.
- +0 −39 bench/instrument.js
- +0 −7 package.json
- +1 −13 packages/next/bin/next.ts
- +196 −209 packages/next/build/index.ts
- +0 −100 packages/next/build/tracer.ts
- +110 −128 packages/next/build/utils.ts
- +11 −15 packages/next/build/webpack/loaders/babel-loader/src/cache.js
- +125 −133 packages/next/build/webpack/loaders/babel-loader/src/index.js
- +19 −19 packages/next/build/webpack/loaders/next-client-pages-loader.ts
- +3 −3 packages/next/build/webpack/loaders/next-serverless-loader/index.ts
- +127 −126 packages/next/build/webpack/plugins/build-manifest-plugin.ts
- +37 −38 packages/next/build/webpack/plugins/build-stats-plugin.ts
- +69 −76 packages/next/build/webpack/plugins/css-minimizer-plugin.ts
- +11 −31 packages/next/build/webpack/plugins/profiling-plugin.ts
- +150 −157 packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js
- +44 −45 packages/next/export/index.ts
- +325 −336 packages/next/export/worker.ts
- +3 −0 packages/next/server/next-dev-server.ts
- +71 −0 packages/next/telemetry/trace/autoparent.ts
- +5 −0 packages/next/telemetry/trace/index.ts
- +33 −0 packages/next/telemetry/trace/report/index.ts
- +26 −0 packages/next/telemetry/trace/report/to-console.ts
- +27 −0 packages/next/telemetry/trace/report/to-telemetry.ts
- +45 −0 packages/next/telemetry/trace/report/to-zipkin.ts
- +12 −0 packages/next/telemetry/trace/shared.ts
- +83 −0 packages/next/telemetry/trace/trace.ts
- +1 −104 yarn.lock
Oops, something went wrong.