Skip to main content

Observability

The service follows the fleet observability standard (ADR 0009): JSON logs on stdout, OTLP/gRPC metrics and traces to a Collector, and trace_id/span_id on every log record written inside a span. All three binaries (cmd/api, cmd/mcp, cmd/a2a) call telemetry.Setup before their router is built (internal/adapters/outbound/telemetry/telemetry.go).

Exporter configuration​

VariableDefaultEffect
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317OTLP/gRPC target for traces and metrics. host:port or a URL.
OTEL_SERVICE_NAMEdelivery-promise (api), delivery-promise-mcp, delivery-promise-a2aservice.name resource attribute
SERVICE_VERSIONdevservice.version
ENVIRONMENTlocaldeployment.environment.name
LOG_LEVELinfolog threshold, see below

Export is deliberately non-blocking: the gRPC exporters connect lazily, so an absent Collector drops telemetry and never delays boot or requests (SDK errors are logged at DEBUG: opentelemetry error). Metrics are pushed every 15 s; the final flush at shutdown is bounded to 5 s. W3C traceparent and baggage propagators are installed globally. The chart's otel.* values render these variables, otel.enabled=false renders none. Full table: Configuration.

Metrics​

Source: internal/adapters/outbound/telemetry/promise_metrics.go, internal/adapters/inbound/http/server.go, cmd/mcp/router.go, cmd/a2a/router.go.

InstrumentTypeUnitAttributesEmitted by
promising.promises.madeInt64 counter{promise}outcome = made or refused; reason (only on refused) = the problem slug, for example offer-not-quotable, promise-capacity-exhausted, internal-errorcmd/api, every MakePromise attempt. Prometheus name promising_promises_made_total
deliverypromise.predicted_late.flaggedInt64 counter{promise}nonecmd/api, the FlagPredictedLate sweep pass, one per promise flagged AT_RISK with PREDICTED_LATE (ADR 0021). Prometheus name deliverypromise_predicted_late_flagged_total
deliverypromise.departure_arrival.ignoredInt64 counter{event}nonecmd/api, the LoadArrived handler, one per event without a departureId (ADR 0021). Prometheus name deliverypromise_departure_arrival_ignored_total
http.server.request.durationFloat64 histogramshttp.method, http.scheme, http.route (chi route pattern, when matched)all three binaries, otelchimetric.NewServerRequestDuration. Prometheus name http_server_request_duration_seconds
Go runtime metricsvariousvariousnoneall three binaries (runtime.Start), goroutines, GC and heap; the dashboard reads go_goroutine_count and go_memory_used_bytes
deliverypromise.tier.candidates.excludedInt64 counter{candidate}tier = SAME_DAY or NEXT_DAYcmd/api and cmd/mcp searches: a candidate node removed because node-performance revoked its eligibility (ADR 0022), once per node and tier per request. Prometheus name deliverypromise_tier_candidates_excluded_total
deliverypromise.tier.eligibility.events.ignoredInt64 counter{event}reason = unknown-tier or missing-fieldcmd/api consumer: a NodeTierEligibilityChanged that cannot be applied. Prometheus name deliverypromise_tier_eligibility_events_ignored_total
deliverypromise.request_facts.writtenInt64 counter{fact}nonecmd/api, only with DELIVERY_REQUEST_FACTS_ENABLED=true: one per DeliveryRequestAnswered fact the background worker stored as an analytics outbox row (ADR 0032). Prometheus name deliverypromise_request_facts_written_total
deliverypromise.request_facts.droppedInt64 counter{fact}reason = queue_full, write_failed, internal_error or shutdowncmd/api, same condition: one per fact LOST by design (best effort, no response is affected). Prometheus name deliverypromise_request_facts_dropped_total

Reading promising.promises.made: a falling made share with a rising offer-not-quotable or promise-capacity-exhausted means shoppers are offered dates the network can no longer keep (expired offers, full nodes); a rising internal-error means the service itself is failing. There is no instrument for outbox depth, consumer lag, sweep counts or DLQ volume; use the SQL and logs in the Runbook.

Traces​

SpanKindCreated byAttributes
otelchi server span, named after the chi route patternserverthe chi router of all three binariesstandard HTTP attributes; named after the route pattern, never the raw path
<topic> processconsumerinternal/adapters/inbound/kafka/tracing.go, one per handling attemptmessaging.system=kafka, messaging.destination.name, messaging.operation.name=process; errors are recorded on the span
a2a.skill <skill>internalinternal/adapters/inbound/a2a/skills.goa2a.skill; status Error with the problem detail when the skill answers a problem

Trace continuity across Kafka: the outbox stores the W3C traceparent/tracestate of the writing request with each row (internal/adapters/outbound/postgres/outbox_trace.go), the relay publishes them as message headers, and the consumer extracts them so its span is a child of the producer's. A message without headers starts a new trace. The MCP adapter creates no tool-level span of its own; MCP calls appear as the HTTP server span of the request.

Logs​

JSON via slog on stdout (newLogger, LOG_LEVEL = debug, info, warn/warning, error). Loki label app is delivery-promise for the api pod. Fields:

FieldWhereMeaning
time, level, msgevery recordslog defaults
trace_id, span_idrecords written with a span-carrying context (*Context slog calls)correlation with Tempo/Jaeger. Records from startup, shutdown and background loops carry none
request_idaccess logthe chi request id
method, route, status, duration_ms, bytesaccess log line http requestroute is the matched pattern; 5xx is logged at ERROR, 4xx at WARN, otherwise INFO. /healthz and /readyz are not logged
worker, errorworker stopped (ERROR)a background worker returned on its own; the process then exits non-zero
pass, countsweep pass (INFO) / sweep pass failed (ERROR)one sweeper pass
outbox_id, topic, event_typeoutbox relay: row reached the attempt cap... (ERROR)a parked outbox row
variable, value, defaultinvalid duration; using the default (WARN)a bad optional duration variable
service_name, otlp_endpointtelemetry configured (INFO, boot)exporter in effect
topics, group_id, brokersconsumer running (INFO, boot)consumer wiring

Useful boot lines, in order for cmd/api: telemetry configured, postgres adapters configured, http server listening, consumer running, sweeper running, outbox relay running. Shutdown logs shutdown: readiness flipped to not-ready; waiting for traffic to drain.

Dashboards and alerts​

Only what exists in warehouse-infra on develop:

  • Dashboard warehouse-delivery-promise ("Warehouse - Delivery Promise", terraform/dashboards/contexts/delivery-promise.json): Kong request rate, 5xx error rate and p95 latency of the context's routes; service HTTP RED (request rate by route, 5xx by Kong route, request duration p95 by process, from http_server_request_duration_seconds); the business panel promising_promises_made_total by outcome; Go goroutines and memory; Loki log stream, log volume by level and errors/warnings for {app="delivery-promise"}.
  • Alerts (terraform/alerting/warehouse-alert-rules.json, groups warehouse-delivery-promise and warehouse-delivery-promise-slo): more than 5 % of requests on a Kong route answering 5xx; a container restarting (two or more restarts in 15 minutes, pod=~"delivery-promise-.+"); API availability SLO fast burn and slow burn; API latency SLO (400 ms upstream) fast burn and slow burn.
  • Not present: alerts or panels for outbox backlog, parked outbox rows, consumer lag or dead letters. Because the process exits on any worker failure, a wedged relay or consumer shows up as the restart alert.

The alert annotations' runbook_url still points at the pre-move path docs/operations/runbook.md on develop; the runbook now lives at Runbook on this site.