Observability
Three things, all in packages/telemetry: structured logs, metrics, and an
optional trace per review. Logs stay inside your deployment. A trace leaves it
only if you configure a destination.
Structured logs
Section titled “Structured logs”Each log line is one JSON object: time, level, event, and fields such as
traceId, reviewId, stage, attempt, outcome, durationMs,
errorCode. Stage events are stage_started, stage_finished (with
outcome succeeded, retrying or failed), stage_skipped_already_completed,
stage_not_started and review_duration_limit. Every string field passes the
redactor before it reaches the sink.
| Host | Where logs go |
|---|---|
| Cloudflare Worker | console (warnings and info via console.warn, errors via console.error), which Workers Logs collects; observability.enabled is set in wrangler.jsonc |
| CLI and MCP server | No structured log by default. The CLI prints stage progress ([stage] status) and notes to stderr. |
Metrics
Section titled “Metrics”Metrics (counters stage_attempts and durations stage_ms per stage and
outcome) exists and the stage runner records into it when a host supplies
one. Both hosts (the local engine and the Worker) supply one for every review.
The metrics stay in the process: they are not exported anywhere in this release.
Stage durations also appear in the logs and the trace.
Traces
Section titled “Traces”One trace per review, exported as OTLP/HTTP JSON with plain fetch (no SDK),
so the same code runs in Workers and Node. Attribute names follow the Langfuse
mapping, so a Langfuse project shows a review as an agent trace; any other
OpenTelemetry backend receives ordinary spans with the same attributes.
review owner/repo#pr agent (root; session id owner/repo#pr)├── stage:discover_deployments span├── stage:analyze_intent span│ └── infer intent generation (model, token usage)├── stage:execute_preview span│ └── browser: <scenario> (preview) tool├── stage:execute_production span│ └── browser: <scenario> (production) tool (twice per scenario)├── stage:measure_performance span (beside the browser stages)│ └── lighthouse <route> (<form factor>) tool├── stage:describe_visual span│ └── describe visual differences generation├── stage:classify span│ ├── classify findings generation│ └── gate <observation id> guardrail (proposed vs decided)└── … report, publishThe session id groups every review of one pull request. Stages of a
deployment run in separate durable invocations, so the root span id is
derived from the trace id; each stage attaches to the same root without shared
memory. A failed stage attempt ends its span with level WARNING (retrying)
or ERROR.
What is redacted or left out
Section titled “What is redacted or left out”- Every exported value passes the same redactor as logs (configured secret
values and secret-shaped text such as tokens, keys and authorization
headers are replaced by
[REDACTED]). - Model prompts and responses are included in
generationobservations only whenmodels.retentionisfull. With the defaultmetadata_only, a generation carries the model, its parameters (effort, output limit, structured-output mode, call site), token usage (input, output, reasoning, cached input), its priced cost (cost_detailsin dollars, andmetadata.costMicros), its status and whether it was answered from cache.
Scores
Section titled “Scores”A finished review attaches scores to its trace: gate_override_rate,
inconclusive_rate, schema_validity (model calls valid on the first
try) and cost_micros. The nightly evaluation attaches its own
(eval_adversarial_agreement, eval_regression_recall,
eval_schema_validity). Scores go to Langfuse’s scores endpoint when
Langfuse is configured (with --trace for the CLI). Under metadata_only
or none only the score’s name, value and identifiers are sent, never a
comment.
- An export failure is logged (
trace_export_failed) and never fails a review.
Turning it on
Section titled “Turning it on”Set either the Langfuse variables or a generic OTLP endpoint. Values below are placeholders.
| Variable | Meaning |
|---|---|
LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY |
Langfuse project keys. Takes precedence when both are set. |
LANGFUSE_BASE_URL |
e.g. https://us.cloud.langfuse.com; default https://cloud.langfuse.com. Spans go to <base>/api/public/otel/v1/traces with basic authentication. |
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT |
Full OTLP/HTTP traces URL of any backend, e.g. https://collector.example.com/v1/traces |
OTEL_EXPORTER_OTLP_HEADERS |
name=value pairs, comma-separated, sent with each export |
- Deployment: the keys and headers are Worker secrets (
wrangler secret put LANGFUSE_SECRET_KEY…), the base URL and endpoint arevarsinwrangler.jsonc. With none set, nothing is exported. - CLI: export the variables in your shell and pass
--tracetoyomorai review.yomorai doctorchecks that the destination is reachable. - Sample-application script:
pnpm tsx scripts/review-variant.ts <variant> --tracereads the same variables from the environment or a.envfile in the repository root;pnpm tsx scripts/trace-smoke.tssends one small test trace.
The destination is one you choose and operate; it is listed among the
outbound destinations in Security.
The trace code is unit-tested (packages/telemetry/src/telemetry.test.ts)
against an in-memory exporter; export to a live Langfuse project is not part
of the test suites.