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
| SLI | Target (SLO) | Measurement window | Notes |
|---|---|---|---|
| API availability | 99.9% | 30-day rolling | All endpoints |
| MR create p95 latency | < 800 ms | 1-hour rolling | NFR-RX-001; excluding IG validator cold starts |
| MD create p95 latency | < 800 ms | 1-hour rolling | |
| Subscription notification handoff p95 | < 10 s | 5-min rolling | NFR-RX-002; after DB commit |
| Error rate (5xx) | < 0.1% | 30-day rolling | |
| Idempotency key resolution time | < 50 ms | 1-hour rolling | |
| IG validation p95 | < 200 ms | 1-hour rolling | Zod; 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 viaX-Correlation-Idand 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
| Metric | Type | Labels |
|---|---|---|
eprescribing_requests_total | Counter | method, resource_type, status_code, tenant_id |
eprescribing_request_duration_seconds | Histogram | operation, tenant_id |
eprescribing_validation_failures_total | Counter | tenant_id, error_type |
eprescribing_idempotency_hits_total | Counter | tenant_id, outcome |
eprescribing_etag_conflicts_total | Counter | tenant_id, resource_type |
eprescribing_outbox_pending_count | Gauge | tenant_id |
eprescribing_subscription_delivery_lag_seconds | Histogram | tenant_id, subscription_id |
eprescribing_dlq_queue_depth | Gauge | tenant_id |
eprescribing_prescription_throughput_total | Counter | tenant_id, direction (created/dispensed) |
Dashboards
| Dashboard | Purpose |
|---|---|
eprescribing-gateway/overview | Request rate, error rate, latency percentiles by tenant |
eprescribing-gateway/prescription-flow | MR created/updated/cancelled, MD created/updated — end-to-end funnel |
eprescribing-gateway/outbox-subscriptions | Outbox pending, DLQ depth, notification delivery lag by subscription |
eprescribing-gateway/validation | IG validation failure rates, error type breakdown by tenant |
eprescribing-gateway/security | Auth failures, persona violations, rate limit hits |
Alerts
| Alert | Condition | Severity | Runbook |
|---|---|---|---|
EprescribingHighErrorRate | 5xx > 1% over 5 min | Critical | /runbooks/eprescribing/high-error-rate.md |
EprescribingMRLatencyHigh | MR create p95 > 2 s over 10 min | Warning | /runbooks/eprescribing/latency-high.md |
EprescribingSubscriptionLagHigh | Notification lag p95 > 60 s over 10 min | Warning | /runbooks/eprescribing/subscription-lag.md |
EprescribingDLQDepthHigh | DLQ depth > 50 per tenant for > 5 min | Warning | /runbooks/eprescribing/dlq-high.md |
EprescribingOutboxStuck | Outbox pending > 200 for > 15 min | Critical | /runbooks/eprescribing/outbox-stuck.md |
EprescribingValidationSpikeHigh | Validation failures > 20/min for a tenant | Warning | /runbooks/eprescribing/validation-spike.md |
EprescribingServiceDown | No successful health checks > 2 min | Critical | /runbooks/eprescribing/service-down.md |
Health Endpoints
| Endpoint | Returns |
|---|---|
GET /health/live | { "status": "ok" } |
GET /health/ready | { "status": "ok", "db": "ok", "nats": "ok", "validator": "ok|degraded" } |