Skip to main content

Observability

The three binaries follow the fleet observability standard (ADR 0010): JSON logs on stdout, and traces and metrics exported over OTLP/gRPC to the Collector. Export is non-blocking: the exporters connect lazily, so a Collector that is down or absent costs telemetry, never availability or start-up (internal/adapters/outbound/telemetry/telemetry.go).

Exporter variables​

VariableDefaultEffect
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317Collector OTLP/gRPC endpoint, host:port or URL. A bare value is rewritten to http://host:port (and the variable is rewritten in place so the SDK stops logging a parse error).
OTEL_SERVICE_NAMEnode-performance (api), node-performance-mcp, node-performance-a2aservice.name of every span and metric, and the Loki app label.
SERVICE_VERSIONdevservice.version.
ENVIRONMENTlocaldeployment.environment.name.
OTEL_RESOURCE_ATTRIBUTESnoneRead by the SDK default resource (telemetry.sdk.* and extra attributes).
LOG_LEVELinfoLog threshold; also gates the SDK's own diagnostics, which are bridged onto the slog handler and logged at DEBUG as opentelemetry error.

Metrics are pushed every 15 s by a periodic reader. Propagation is W3C traceparent plus baggage. The chart renders the first four from otel.*, image.tag and environment.

Metrics​

InstrumentTypeUnitAttributesSource
nodeperformance.scorecards.recomputed (Prometheus: nodeperformance_scorecards_recomputed_total)Int64 counter{scorecard}outcome = recomputed | failed; reason on failures = concurrent-update | internal-errorinternal/adapters/outbound/telemetry/scorecard_metrics.go, recorded by Recompute.Run (internal/application/usecases/recompute.go) in the api process only
nodeperf.fast_tier.ineligible_nodes (Prometheus: nodeperf_fast_tier_ineligible_nodes)Int64 observable gauge{node}noneinternal/adapters/outbound/telemetry/fast_tier_gauge.go; counts the 7d scorecards suspended from the fast tiers (ADR 0013) with one query at each collection, in the api process only
http.server.request.durationFloat64 histogramsroute pattern, method, status class (otelchi metric)otelchimetric.NewServerRequestDuration in the REST, MCP and A2A routers
Go runtime metrics (goroutines, memory, GC)gauges / countersn/anonego.opentelemetry.io/contrib/instrumentation/runtime v0.72.0, started by telemetry.Setup; instrument names depend on that library's naming mode, the dashboard queries accept both go_goroutine_count and runtime_go_goroutines

The counter's meaning (from its description in the code): a recomputed count that stays flat while nodes keep reporting means grading has stalled and published grades are going stale; a rising concurrent-update means writers contend for the same scorecards but the next run retries them; a rising internal-error means the service itself, usually its database, is failing. A scorecard that vanished or was no longer due is not counted as an attempt.

The gauge rises when nodes lose the SAME_DAY and NEXT_DAY tiers and falls when they are reinstated; one that stays high while the nodes keep delivering on time means reinstatement is stuck (check the recompute scheduler). A failed count skips the data point and logs a warning instead of reporting a zero. Each flip is also logged at INFO as fast tier eligibility changed with node_id, eligible, metric, value, threshold and window.

There is no consumer-lag, outbox-backlog or DLQ instrument. Use the SQL and log signals in the Runbook for those.

Spans​

SpanKindWhereNotes
<METHOD> <route pattern> (for example GET /scorecards/{nodeId})serverotelchi middleware in the api, mcp and a2a routersnamed after the chi route pattern, never the raw path
<topic> process (for example retailnetwork.delivery-promise.events process)consumerinternal/adapters/inbound/kafka/tracing.goattributes messaging.system=kafka, messaging.destination.name, messaging.operation.name=process; parented to the traceparent of the message when present, otherwise a new trace; handler errors are recorded on the span
a2a.skill <skill>internalinternal/adapters/inbound/a2a/skills.goattribute a2a.skill; status Error with the problem detail when the skill answered a problem

Trace continuity across Kafka: when a span is active while events are appended to the outbox (an event applied by a consumer span), the traceparent/tracestate headers are stored with the outbox row and published as ordinary Kafka headers (internal/adapters/outbound/postgres/outbox_trace.go); the CloudEvents attributes and body are untouched. Events appended by the recompute scheduler carry no span context.

Logs​

JSON on stdout, one object per line (log/slog JSON handler wrapped by telemetry.WithTraceContext). Every record written with a span-carrying context also has trace_id and span_id. Standard keys: time, level, msg.

Access log (REST, MCP and A2A routers, internal/adapters/inbound/requestlog), message http request: method, route (the matched pattern, unmatched for anything else), status, duration_ms, bytes, request_id. A 5xx is logged at ERROR, a 4xx at WARN, everything else at INFO; /healthz and /readyz are not logged. Real line:

{"time":"2026-10-31T19:21:24.175464-03:00","level":"WARN","msg":"http request","method":"GET","route":"/scorecards/{nodeId}","status":404,"duration_ms":6,"bytes":137,"request_id":"host/udMqaZi8zF-000002","trace_id":"9de15fcab788ae2cd9d3553a8e37d00c","span_id":"e6033835721cfa63"}

Lifecycle and worker messages worth alerting or grepping on:

MessageLevelFieldsMeaning
telemetry configuredINFOservice_name, otlp_endpointexporters created
postgres adapters configured / postgres reader configuredINFOmigrations ran and the pool answered a ping
consumer configuredINFOconsumer, topicone per consumer, at boot
worker running / worker stoppedINFO / ERRORworker, errora stopped worker makes the process exit non-zero
outbox relay configuredINFOinterval, max_attempts, events_topic, analytics_topicrelay settings in force
http server listeningINFOaddr
recompute round / recompute round failedINFO / ERRORrecomputed, events, conflicts / errorone line per scheduler tick
event processedINFOtype, event_id, subject, outcome (applied, duplicate, ignored)one per consumed event
skipping a message that is not a valid CloudEventWARNconsumer, topic, errorskipped, not dead-lettered
dead-lettering an event that can never be appliedWARNconsumer, type, event_id, errorinvalid payload, sent to <topic>.dlq at once
<consumer> handling failed; retrying the same messageERRORerror, partition, offsettransient failure, retry with backoff
<consumer> handling failed after the maximum attempts; dead-lettering the messageERRORerror, partition, offset, attempts5 attempts exhausted
<consumer> broker connection stalled or lost; fetching again after the backoffWARNbroker unreachable
outbox relay: row reached the attempt cap and is excluded from future claims; re-arm it with attempts = 0 after fixing the causeERRORoutbox_id, topic, event_type, key, attempts, max_attempts, erroronce per parked row
outbox relay pass failedERRORerrorthe pass is retried after the interval
readiness: dependency is not readyWARNdependency (postgres or kafka), errorthe cause behind a /readyz 503
shutdown: readiness flipped to not-ready; waiting for traffic to drainINFOdrain_delayshutdown started
worker did not stop before the shutdown drain deadlineWARNworkera worker overran its 10 s bound
retrying / succeeded after retryWARN / INFOop, attempt, in, errboot retries of migrations and the first ping
mcp tool failed with an unexpected error, a2a skill failedERRORerroran unexpected (non-problem) failure in the MCP or A2A adapter
panic in handler, request failedERRORpanic/error, method, patha REST 500

Dashboards and alerts that exist​

Only what is in warehouse-infra develop; none of it is defined in this repository.

  • Dashboard warehouse-node-performance (terraform/dashboards/contexts/node-performance.json): Kong request rate, 5xx ratio and p95 request versus upstream latency for the context's routes; request rate and p95 duration by service_name=~"node-performance.*"; the business counter sum by (outcome) (rate(nodeperformance_scorecards_recomputed_total[5m])); Go goroutines and memory; Loki live stream, log volume by level and errors-and-warnings for {app="node-performance", container!~"istio-proxy|istio-init"}.
  • Alerts (terraform/alerting/warehouse-alert-rules.json): WarehouseKong5xxRatioHigh, WarehousePodRestarting, and the SLO burn alerts WarehouseApiAvailabilityBurnFast, WarehouseApiLatencyBurnFast (critical) and ...BurnSlow (warning).
  • Not covered: no alert on outcome="failed", consumer lag, DLQ traffic or the unpublished outbox tail. They are manual checks (see Troubleshooting).