Skip to main content

Ghasi e-Prescribing Gateway Service — Observability

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD

SLIs and SLOs

SLITarget (SLO)Measurement windowNotes
API availability99.9%30-day rollingAll endpoints
MR create p95 latency< 800 ms1-hour rollingNFR-RX-001; excluding IG validator cold starts
MD create p95 latency< 800 ms1-hour rolling
Subscription notification handoff p95< 10 s5-min rollingNFR-RX-002; after DB commit
Error rate (5xx)< 0.1%30-day rolling
Idempotency key resolution time< 50 ms1-hour rolling
IG validation p95< 200 ms1-hour rollingZod; HAPI target in Phase 2

OpenTelemetry Instrumentation

  • Traces: Distributed tracing spans across EHR → fhir-gateway → e-prescribing-gateway (NFR-RX-005). Span names: eprescribing.{operation}. Correlation ID propagated via X-Correlation-Id and OTel baggage.
  • Metrics: Prometheus-compatible via OTLP; exported to Grafana.
  • Logs: Structured JSON; tenantId, prescriptionBusinessId, actorId, traceId, spanId. No PHI in messages (IDs only).

Key Metrics

MetricTypeLabels
eprescribing_requests_totalCountermethod, resource_type, status_code, tenant_id
eprescribing_request_duration_secondsHistogramoperation, tenant_id
eprescribing_validation_failures_totalCountertenant_id, error_type
eprescribing_idempotency_hits_totalCountertenant_id, outcome
eprescribing_etag_conflicts_totalCountertenant_id, resource_type
eprescribing_outbox_pending_countGaugetenant_id
eprescribing_subscription_delivery_lag_secondsHistogramtenant_id, subscription_id
eprescribing_dlq_queue_depthGaugetenant_id
eprescribing_prescription_throughput_totalCountertenant_id, direction (created/dispensed)

Dashboards

DashboardPurpose
eprescribing-gateway/overviewRequest rate, error rate, latency percentiles by tenant
eprescribing-gateway/prescription-flowMR created/updated/cancelled, MD created/updated — end-to-end funnel
eprescribing-gateway/outbox-subscriptionsOutbox pending, DLQ depth, notification delivery lag by subscription
eprescribing-gateway/validationIG validation failure rates, error type breakdown by tenant
eprescribing-gateway/securityAuth failures, persona violations, rate limit hits

Alerts

AlertConditionSeverityRunbook
EprescribingHighErrorRate5xx > 1% over 5 minCritical/runbooks/eprescribing/high-error-rate.md
EprescribingMRLatencyHighMR create p95 > 2 s over 10 minWarning/runbooks/eprescribing/latency-high.md
EprescribingSubscriptionLagHighNotification lag p95 > 60 s over 10 minWarning/runbooks/eprescribing/subscription-lag.md
EprescribingDLQDepthHighDLQ depth > 50 per tenant for > 5 minWarning/runbooks/eprescribing/dlq-high.md
EprescribingOutboxStuckOutbox pending > 200 for > 15 minCritical/runbooks/eprescribing/outbox-stuck.md
EprescribingValidationSpikeHighValidation failures > 20/min for a tenantWarning/runbooks/eprescribing/validation-spike.md
EprescribingServiceDownNo successful health checks > 2 minCritical/runbooks/eprescribing/service-down.md

Health Endpoints

EndpointReturns
GET /health/live{ "status": "ok" }
GET /health/ready{ "status": "ok", "db": "ok", "nats": "ok", "validator": "ok|degraded" }