matrix-public-archive/server
Eric Eastwood 9c0b6fe85e
Production ready build (#175)
- Rename `public` -> `client` so it doesn't get copied automagically as-is (without hashes which we want for cache busting), https://vitejs.dev/guide/assets.html#the-public-directory
     - We still build the version files to `public/` so their copied as-is and Vite handles it for us (so we can use `emptyOutDir`) 
 - Use a multiple entrypoint `.js` Vite build so things can be more intelligently bundled and take less time
     - We aren't using library mode because it doesn't minify or bundle assets
 - Using hash asset tags for cache busting. Hash of the file included in the file name
 - We lookup these hashed assets from `manifest.json` that Vite builds (https://vitejs.dev/guide/backend-integration.html) to serve and preload
 - In terms of optimized bundles, I know the current output isn't great now but will have to opt to fix that up separately in the future. Tracked by https://github.com/matrix-org/matrix-public-archive/issues/176
2023-04-24 23:50:53 -05:00
..
child-process-runner Add a way to select time of day (#139) 2023-04-05 04:25:31 -05:00
hydrogen-render Production ready build (#175) 2023-04-24 23:50:53 -05:00
lib Production ready build (#175) 2023-04-24 23:50:53 -05:00
middleware Add route identifiers for easy metric reporting (#173) 2023-04-19 15:09:51 -05:00
routes Production ready build (#175) 2023-04-24 23:50:53 -05:00
tracing Add domain to tracing service to distinguish different Matrix public archive instances (#76) 2022-10-11 16:03:33 -05:00
README.md Add available Jaeger port (#48) 2022-08-29 14:08:15 -05:00
server.js Enable tracing by config so we can enable from argv, env variable, or config file (#41) 2022-07-14 11:26:53 -05:00
start-dev.js Production ready build (#175) 2023-04-24 23:50:53 -05:00

README.md

Tracing

Run the app with the OpenTelemetry tracing.

npm run start -- --tracing
# or
npm run start-dev -- --tracing

Manually:

node --require './server/tracing.js' server/server.js

Traces are made up of many spans. Each span defines a traceId which it is associated with.

Viewing traces in Jaeger

via https://www.jaegertracing.io/docs/1.35/getting-started/

docker run -d --name jaeger \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 5775:5775/udp \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  -p 14250:14250 \
  -p 14268:14268 \
  -p 14269:14269 \
  -p 9411:9411 \
  jaegertracing/all-in-one:1.35
Port Protocol Component Function
6831 UDP agent accept jaeger.thrift over Thrift-compact protocol (used by most SDKs)
6832 UDP agent accept jaeger.thrift over Thrift-binary protocol (used by Node.js SDK)
5775 UDP agent (deprecated) accept zipkin.thrift over compact Thrift protocol (used by legacy clients only)
5778 HTTP agent serve configs (sampling, etc.)
16686 HTTP query serve frontend
4317 HTTP collector accept OpenTelemetry Protocol (OTLP) over gRPC, if enabled
4318 HTTP collector accept OpenTelemetry Protocol (OTLP) over HTTP, if enabled
14268 HTTP collector accept jaeger.thrift directly from clients
14250 HTTP collector accept model.proto
9411 HTTP collector Zipkin compatible endpoint (optional)

With Service Performance Monitoring (SPM)