verex

Observability — OpenTelemetry-first instrumentation, swappable backend

Goal: decide how Verex answers “which step is slow?” — and instrument in a way that does not marry us to whichever vendor we pick this year.

Source: conversation 2026-08-17 KST (Datadog / OpenTelemetry walkthrough); no external doc. Prompted by the Datadog agent question — what an agent actually collects, and where traces come from.

1. One-liner

Metrics say “it’s slow”, traces say “this step is slow”, logs say “here’s why” — and only the first comes free from an agent. Traces are generated by a library running inside the process, so the instrumentation choice is a code decision, not an infra one. Instrument with OpenTelemetry (a protocol, not a product) and the export target becomes one config line.

2. Why OTel rather than a vendor SDK

3. Verex touchpoints

Verex track What it needs Note
ChainJob worker (api) Distributed trace: enqueue → build tx → submit → confirm The one place metrics structurally cannot answer the question. Highest value, do first
api-indexer.md (S4–S5) Request traces + span from API → indexer Do together with the worker — same trace context or the picture breaks at the boundary
mm-agent.md (S2.5 → S6) Quote/decision latency Second candidate; only once the worker path proves the setup
web-ui.md (S3) RUM (browser) Lowest priority — defer until there are real users
GCP infra Export target Cloud Run has no host for a normal agent: sidecar, serverless-init, or direct OTLP export

4. Standing rule — metric cardinality

Never tag a metric with an unbounded value. In Verex the tempting ones are exactly the dangerous ones: market_id, user_id, tx_hash, order_id. Each distinct tag combination bills as a separate custom metric, so one line of code becomes a five-figure invoice. Those belong on spans and logs (where high cardinality is the point), never on metrics. Writing this down before anyone adds the first one is cheaper than finding it on a bill.

Features