Observability
Which binaries emit what
| Binary | Traces | Metrics | Logs |
|---|---|---|---|
pathmgmt | yes (otelchi HTTP server spans) | yes | JSON to stdout, trace_id/span_id on request-scoped lines |
mcp | yes (one span per tool call) | Go runtime only | JSON to stdout, trace_id/span_id inside tool calls |
pathmgmt-projector | no spans (the consumer is not instrumented) | Go runtime only | JSON to stdout, through the trace-aware handler |
pathmgmt-reports | no spans (no HTTP middleware) | Go runtime only | JSON 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_VERSIONor ldflags),deployment.environment.name(ENVIRONMENT, defaultlocal), plus the SDK defaults.
Export never blocks startup. With no Collector you get periodic exporter errors in the log and nothing else.
Metrics
| Instrument | Type | Unit | Attributes | Emitted by | Source |
|---|---|---|---|---|---|
process_path_management.paths.defined | Int64Counter | {path} | outcome = accepted | rejected | pathmgmt, from the DefinePath use case | internal/adapters/outbound/telemetry/metrics.go |
process_path_management.outbox.lag_seconds | Float64ObservableGauge | s | none | pathmgmt, only when DATABASE_URL is set | internal/adapters/outbound/postgres/outbox_metrics.go |
http.server.request.duration | Float64Histogram | s | otelchi semantic-convention attributes (method, route, status code) | pathmgmt REST router only | otelchimetric.NewServerRequestDuration in internal/adapters/inbound/http/server.go |
Go runtime metrics (go.goroutine.count, go.memory.used, ...) | various | various | — | all four binaries | runtime.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
| Span | Kind | Emitted by | Attributes |
|---|---|---|---|
one per HTTP request, named after the chi route pattern (e.g. /process-paths/{pathId}), not the raw path | server | pathmgmt (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_report | internal | mcp (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.
| Message | Level | Fields | Emitted by |
|---|---|---|---|
http request | INFO | method, route (pattern; raw path with CR/LF stripped on 404), status, bytes, duration_ms, request_id | pathmgmt, pathmgmt-reports (internal/adapters/inbound/http/logging.go) |
domain event published | INFO | event_name, payload | the LogPublisher test double only (no binary wires it) |
telemetry configured | INFO | service_name, service_version, environment, otlp_endpoint | pathmgmt, projector, reports (mcp logs service_name, otlp_endpoint) |
http server listening / mcp server listening (Streamable HTTP) / reports server listening / projector admin server listening | INFO | addr | each binary |
kafka event publishing enabled (transactional outbox) | INFO | brokers, topic, analytics_topic, outbox_max_attempts | pathmgmt |
outbox relay running | INFO | topic | pathmgmt |
outbox relay pass failed | ERROR | error | pathmgmt |
outbox relay: row reached the attempt cap and is no longer claimed | ERROR | outbox_id, topic, event_type, key, attempts, max_attempts, error, rearm | pathmgmt, once per row that reaches OUTBOX_MAX_ATTEMPTS (ADR 0030) |
outbox relay published events | DEBUG | count | pathmgmt |
outbox relay did not stop before the shutdown deadline | WARN | — | pathmgmt |
outbox lag gauge registration failed | WARN | error | pathmgmt |
housekeeping sweeper configured | INFO | interval, enabled, idempotency_key_ttl, outbox_retention (a 0s value means that part is disabled) | pathmgmt |
housekeeping sweeper running | INFO | — | pathmgmt |
housekeeping sweep | INFO | idempotency_keys_deleted, outbox_events_deleted (only when something was deleted) | pathmgmt |
housekeeping sweep failed | ERROR | error, idempotency_keys_deleted, outbox_events_deleted | pathmgmt |
retrying | WARN | op (run migrations, ping database, run analytics migrations, ping analytics database), attempt, in, err | all, at boot |
succeeded after retry | INFO | op, attempt | all, at boot |
analytics consumer starting | INFO | topic, group, brokers | projector |
analytics: rejecting non-CloudEvents kafka message | WARN | topic, partition, offset, error | projector |
analytics: sending message to dead-letter topic | ERROR | dlq_topic, ce_id, ce_type, error | projector |
analytics consumer loop exited; stopping the projector so it is restarted | ERROR | error (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 deadline | WARN | — | projector |
service exited with error / mcp server exited with error / pathmgmt-projector exited with error / pathmgmt-reports exited with error | ERROR | error | each 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-managementroute: request rate, 5xx ratio, p95 latency (Kong vs upstream); - service HTTP RED from
http_server_request_duration_secondsfiltered onservice_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.
| Alert | Expression (PromQL / LogQL) | Why |
|---|---|---|
| Outbox stuck | max(process_path_management_outbox_lag_seconds) > 60 for 5 m | The 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 parked | LogQL: count_over_time({app="process-path-management"} |= "reached the attempt cap" [15m]) > 0 | A row failed OUTBOX_MAX_ATTEMPTS times and is no longer published; re-arm it after fixing the cause (Runbook). |
| REST 5xx | 5xx ratio of http_server_request_duration_seconds_count{service_name="process-path-management"} > 5 % for 10 m | Database unreachable or statement timeouts (statement_timeout=5s). |
| Path definitions rejected | rate(process_path_management_paths_defined_total{outcome="rejected"}[15m]) > rate(...{outcome="accepted"}[15m]) | A client is sending malformed definitions. |
| Analytics consumer dead | LogQL: count_over_time({app="process-path-management"} |= "analytics consumer loop exited" [5m]) > 0, or restarts of the analytics-projector pods | Since 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 writes | LogQL on analytics: sending message to dead-letter topic, or a broker-side message-rate alert on warehouse.process-path-management.analytics.dlq | Poison messages in the analytics stream. |
| Boot retries | LogQL 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.