Observability
Recommended logging
For every API call, the following should be logged:
| Field | Reason |
|---|---|
| Timestamp | Time-based auditing |
| Method + URL | Endpoint identification |
| HTTP status | Diagnostics |
| Latency | Performance |
Idempotency-Key (if POST) | Traceability |
clave (if present in the response) | Traceability |
API key prefix (lxs_live_a1b2c3d4_) | Identification for support |
The full API key must never be logged. Only the prefix (the first 17 characters).
Metrics to monitor
- Success rate (% of
2xx). - p50, p95, p99 latency of
POST /facturas. - % of webhooks received vs. documents issued.
- Documents rejected by Hacienda (alert if > 5%).
- Average age of documents in
procesando(alert if > 10 min).