matrix-public-archive/server
Michael[tm] Smith 2999691eea
Enable CORS support (#147)
This change enables CORS support in the archive — to allow web developers to create web applications with frontend JavaScript code that can fetch pages from the archive (for example, for scraping content from chat logs).

Otherwise, without this change, web developers can’t create web apps with frontend JavaScript that can fetch chat logs from the archive and then consume the content of the logs.

It’s imaginable that web developers may find use cases for consuming the chat logs in the archive from frontend JavaScript code — at the simplest level, web apps that fetch and scrape logs to get data out of them or to pull out particular snippets from the logs.

Developers can anyway already scrape the contents of the archive — by using server-side programming languages or by using `curl` or whatever from the command line. They just can’t do the same from frontend JavaScript code, unless CORS support is enabled.
2022-11-28 21:47:57 -06:00
..
child-process-runner Room directory landing page v1 (#61) 2022-09-08 01:30:04 -05:00
hydrogen-render Only assign `vmContext.global.crypto` if not already global (#143) 2022-11-18 12:27:50 -06:00
lib Refactor `fetchEndpointAsText`/`fetchEndpointAsJson` to return `res` alongside `data` (#122) 2022-11-03 04:12:00 -05:00
routes Enable CORS support (#147) 2022-11-28 21:47:57 -06: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 Show surrounding messages for a full screen of content (#71) 2022-09-20 16:02:09 -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)