Skip to main content

Observability

Which binaries emit what​

BinaryTracesMetricsLogs
pathmgmtyes (otelchi HTTP server spans)yesJSON to stdout, trace_id/span_id on request-scoped lines
mcpyes (one span per tool call)Go runtime onlyJSON to stdout, trace_id/span_id inside tool calls
pathmgmt-projectorno spans (the consumer is not instrumented)Go runtime onlyJSON to stdout, through the trace-aware handler
pathmgmt-reportsno spans (no HTTP middleware)Go runtime onlyJSON to stdout, through the trace-aware handler

Since gap fix D21 (ADR 0029) the projector and reports binaries call telemetry.Setup like pathmgmt and mcp: the same OTLP exporters, the W3C propagator, the deployment.environment.name resource and Go runtime metrics, under the service names pathmgmt-projector and pathmgmt-reports. Their consumer and router still open no spans, so their main signals are logs, the probes and the freshness endpoint. Each logs telemetry configured at boot.

Export​

There is no /metrics endpoint. All four binaries push traces and metrics over OTLP/gRPC, insecure, to OTEL_EXPORTER_OTLP_ENDPOINT (default localhost:4317; the chart sets otel-collector.observability.svc.cluster.local:4317) (internal/adapters/outbound/telemetry/telemetry.go):

  • traces: batch span processor;
  • metrics: periodic reader, every 30 s;
  • propagator: W3C traceparent + baggage;
  • resource: service.name (OTEL_SERVICE_NAME), service.version (SERVICE_VERSION or ldflags), deployment.environment.name (ENVIRONMENT, default local), plus the SDK defaults.

Export never blocks startup. With no Collector you get periodic exporter errors in the log and nothing else.

Metrics​

InstrumentTypeUnitAttributesEmitted bySource
process_path_management.paths.definedInt64Counter{path}outcome = accepted | rejectedpathmgmt, from the DefinePath use caseinternal/adapters/outbound/telemetry/metrics.go
process_path_management.outbox.lag_secondsFloat64ObservableGaugesnonepathmgmt, only when DATABASE_URL is setinternal/adapters/outbound/postgres/outbox_metrics.go
http.server.request.durationFloat64Histogramsotelchi semantic-convention attributes (method, route, status code)pathmgmt REST router onlyotelchimetric.NewServerRequestDuration in internal/adapters/inbound/http/server.go
Go runtime metrics (go.goroutine.count, go.memory.used, ...)variousvarious—all four binariesruntime.Start in telemetry.go

process_path_management.paths.defined counts attempts to create a path. rejected covers aggregate invariant failures and a duplicate pathId (internal/application/usecases/define_path.go); a rising rejected rate points at a broken client form, not at the service. Requests rejected by the HTTP handler before the use case runs (malformed JSON, an unparseable cycleTimeP95, an unknown destinationLocationRole, a missing Idempotency-Key) are not counted. Revise, deactivate and CPT schedule writes have no business counter.

process_path_management.outbox.lag_seconds runs one query per collection (every 30 s): the age of the oldest row in outbox_events with published_at IS NULL, or 0 when the outbox is drained. It is registered whenever Postgres is configured (always, ADR 0037).

In Prometheus (through the Collector) these appear as process_path_management_paths_defined_total, process_path_management_outbox_lag_seconds and http_server_request_duration_seconds_*.

The MCP binary has no HTTP metrics middleware, and the reports router has no OTel middleware, so http.server.request.duration covers only the REST API.

Traces​

SpanKindEmitted byAttributes
one per HTTP request, named after the chi route pattern (e.g. /process-paths/{pathId}), not the raw pathserverpathmgmt (otelchi.Middleware with WithChiRoutes)otelchi HTTP semantic-convention attributes
mcp.tool get_process_path, mcp.tool list_process_paths, mcp.tool get_cpt_schedule, mcp.tool get_process_flow, mcp.tool list_process_flows, mcp.tool get_catalogue_growth_reportinternalmcp (internal/adapters/inbound/mcp/tools.go)mcp.tool.name; status Error with the message when the tool fails

There are no database or Kafka client spans (pgx and kafka-go are not instrumented). Instead, the trace context of the request that raised an event is stored on its outbox_events row (traceparent, tracestate) and sent as Kafka headers when the relay publishes, so a consumer can continue the trace started by the operator's REST call (ADR 0027). The relay itself starts no span.

Logs​

All four binaries log JSON (log/slog) to stdout at LOG_LEVEL (debug, info, warn or warning, error). In every binary the handler is wrapped by telemetry.TraceHandler, which adds trace_id and span_id to any record logged with a context that carries a valid span.

MessageLevelFieldsEmitted by
http requestINFOmethod, route (pattern; raw path with CR/LF stripped on 404), status, bytes, duration_ms, request_idpathmgmt, pathmgmt-reports (internal/adapters/inbound/http/logging.go)
domain event publishedINFOevent_name, payloadthe LogPublisher test double only (no binary wires it)
telemetry configuredINFOservice_name, service_version, environment, otlp_endpointpathmgmt, projector, reports (mcp logs service_name, otlp_endpoint)
http server listening / mcp server listening (Streamable HTTP) / reports server listening / projector admin server listeningINFOaddreach binary
kafka event publishing enabled (transactional outbox)INFObrokers, topic, analytics_topic, outbox_max_attemptspathmgmt
outbox relay runningINFOtopicpathmgmt
outbox relay pass failedERRORerrorpathmgmt
outbox relay: row reached the attempt cap and is no longer claimedERRORoutbox_id, topic, event_type, key, attempts, max_attempts, error, rearmpathmgmt, once per row that reaches OUTBOX_MAX_ATTEMPTS (ADR 0030)
outbox relay published eventsDEBUGcountpathmgmt
outbox relay did not stop before the shutdown deadlineWARN—pathmgmt
outbox lag gauge registration failedWARNerrorpathmgmt
housekeeping sweeper configuredINFOinterval, enabled, idempotency_key_ttl, outbox_retention (a 0s value means that part is disabled)pathmgmt
housekeeping sweeper runningINFO—pathmgmt
housekeeping sweepINFOidempotency_keys_deleted, outbox_events_deleted (only when something was deleted)pathmgmt
housekeeping sweep failedERRORerror, idempotency_keys_deleted, outbox_events_deletedpathmgmt
retryingWARNop (run migrations, ping database, run analytics migrations, ping analytics database), attempt, in, errall, at boot
succeeded after retryINFOop, attemptall, at boot
analytics consumer startingINFOtopic, group, brokersprojector
analytics: rejecting non-CloudEvents kafka messageWARNtopic, partition, offset, errorprojector
analytics: sending message to dead-letter topicERRORdlq_topic, ce_id, ce_type, errorprojector
analytics consumer loop exited; stopping the projector so it is restartedERRORerror (wraps analytics consumer loop exited)projector: the loop returned on its own; readiness flips to not-ready and the process exits 1 (gap fix D13, see Troubleshooting)
analytics consumer did not stop before the shutdown deadlineWARN—projector
service exited with error / mcp server exited with error / pathmgmt-projector exited with error / pathmgmt-reports exited with errorERRORerroreach binary, last line before exit 1

Dashboards​

warehouse-infra provisions a Grafana dashboard for this context, terraform/dashboards/contexts/process-path-management.json ("Warehouse — Process Path Management", checked on warehouse-infra develop at f9ec4cd). Its rows:

  • Kong north-south view of the /api/process-path-management route: request rate, 5xx ratio, p95 latency (Kong vs upstream);
  • service HTTP RED from http_server_request_duration_seconds filtered on service_name=~"process-path-management.*": rate by route, 5xx by process, p95 by process;
  • business: sum by (outcome) (rate(process_path_management_paths_defined_total[5m]));
  • Go runtime: goroutines and memory used;
  • Loki logs for app="process-path-management" (application containers only): live stream, volume by level, errors and warnings.

The HTTP RED row title mentions projector, reports and MCP, but only pathmgmt emits that histogram (see above). The outbox lag gauge is not on the dashboard.

Suggested alerts​

These are not provisioned anywhere today.

AlertExpression (PromQL / LogQL)Why
Outbox stuckmax(process_path_management_outbox_lag_seconds) > 60 for 5 mThe relay is failing or not running, or a row is parked at the attempt cap; consumers are not seeing changes. Normal value is under ~1 s.
Outbox row parkedLogQL: count_over_time({app="process-path-management"} |= "reached the attempt cap" [15m]) > 0A row failed OUTBOX_MAX_ATTEMPTS times and is no longer published; re-arm it after fixing the cause (Runbook).
REST 5xx5xx ratio of http_server_request_duration_seconds_count{service_name="process-path-management"} > 5 % for 10 mDatabase unreachable or statement timeouts (statement_timeout=5s).
Path definitions rejectedrate(process_path_management_paths_defined_total{outcome="rejected"}[15m]) > rate(...{outcome="accepted"}[15m])A client is sending malformed definitions.
Analytics consumer deadLogQL: count_over_time({app="process-path-management"} |= "analytics consumer loop exited" [5m]) > 0, or restarts of the analytics-projector podsSince gap fix D13 the projector exits 1 when its consumer loop stops, so a broken broker or analytics database shows up as restarts (and eventually CrashLoopBackOff).
DLQ writesLogQL on analytics: sending message to dead-letter topic, or a broker-side message-rate alert on warehouse.process-path-management.analytics.dlqPoison messages in the analytics stream.
Boot retriesLogQL on "msg":"retrying"Postgres slow to accept connections at pod start (Istio sidecar warm-up or a real outage).

Consumer lag of group process-path-management-analytics can only be measured on the broker side (for example a Kafka exporter); the service does not export it.