Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

relay-observability.md

53 lines2.3 KB

1# Relay observability
2​
3> For maintainers. Using T3 Code? See [docs/user](../user/).
4​
5The relay Alchemy stack owns a shared Axiom trace setup:
6​
7- `t3-code-relay-traces-prod`, the OpenTelemetry trace dataset shared by the Worker, mobile app, and
8 first-party relay clients
9- `t3-code-relay-otel-ingest-prod`, the dataset-scoped Worker ingest token
10- `t3-code-mobile-otel-ingest-prod`, the dataset-scoped mobile ingest token
11- `t3-code-relay-client-otel-ingest-prod`, the dataset-scoped first-party relay-client ingest token
12- `t3-code-relay-recent-spans-prod`, a view of recent request and endpoint spans
13​
14Alchemy stages append their sanitized stage name to isolate resources, for example
15`t3-code-relay-traces-dev-julius` for a personal stage.
16​
17Deploy from `infra/relay` with the normal Alchemy workflow:
18​
19```sh
20vp run deploy
21```
22​
23Alchemy resolves account-level Axiom deployment credentials through its provider. At runtime, the
24Worker receives only its scoped ingest token. Mobile and relay clients use their own separately
25provisioned scoped ingest tokens.
26​
27The Worker emits Effect's built-in HTTP server spans plus endpoint and database child spans.
28Effect's OpenTelemetry exporter stores semantic HTTP attributes below the `attributes.` prefix.
29For example:
30​
31```apl
32['t3-code-relay-traces-prod']
33| where name startswith 'http.server'
34| extend endpoint = column_ifexists('attributes.http.route', ''),
35 customAttributes = column_ifexists('attributes.custom', dynamic({}))
36| project _time, name, trace_id, duration,
37 ['attributes.http.request.method'],
38 ['attributes.url.path'],
39 ['attributes.http.response.status_code'],
40 endpoint,
41 relayOperation = customAttributes['relay']['operation']
42| order by _time desc
43| limit 200
44```
45​
46The provisioned view also reads the endpoint from `attributes.http.route`. Relay-specific span
47annotations are stored under `attributes.custom`; `relay.operation` is one of the emitted custom
48attributes.
49​
50Agents should prefer the provisioned view or APL queries for completed incidents instead of
51tailing the Cloudflare Worker. The stack does not provision a separate query token. Responders who
52need scripted query access use the authorized account-level `AXIOM_TOKEN` together with
53`AXIOM_ORG_ID`; scoped ingest tokens remain write-only credentials for their producers.