OpenTelemetry tracing so we can see spans where the app is taking time.
For the user, we specifically show the spans for the external API HTTP requests
that are slow (so we know when the Matrix API is being slow).
Enable tracing:
- `npm run start -- --tracing`
- `npm run start-dev -- --tracing`
What does this PR change:
- Adds OpenTelemetry tracing with some of the automatic instrumentation (includes HTTP and express)
- We ignore traces for serving static assets (just noise)
- Adds `X-Trace-Id` to the response headers
- Adds `window.tracingSpansForRequest` which includes the external HTTP API requests made during the request
- Adds a fancy 504 timeout page that includes trace details and lists the slow HTTP requests
- Adds `jaegerTracesEndpoint` configuration to export tracing spans to Jaeger
- Related to, https://github.com/matrix-org/matrix-public-archive/issues/26
We now run the Hydrogen render in a `child_process` so we can exit the whole render process. We still use the `vm` to setup the browser-like globals. With a `vm`, everything continues to run even after it returns and there isn't a way to clean up, stop, kill, terminate the vm script or context so we need this extra `child_process` now to clean up. I don't like the complexity necessary for this though. I wish the `vm` API allowed for this use case. The only way to stop a `vm` is the `timeout` and we want to stop as soon as we return.
Fix https://github.com/matrix-org/matrix-public-archive/issues/34