Problem
HTTP metrics tell you the API is responding. They don't tell you the billing pipeline is healthy. We need metrics for business-critical operations.
Proposed solution
Add custom Prometheus metrics:
meterplex_usage_events_ingested_total — counter by tenant, feature, status (accepted/rejected/duplicate)
meterplex_usage_events_validated_total — counter by result (valid/rejected/dead_letter)
meterplex_usage_events_aggregated_total — counter
meterplex_outbox_pending_count — gauge (current PENDING outbox rows)
meterplex_outbox_publish_duration_seconds — histogram
meterplex_dead_letter_total — counter by stage (validation/aggregation/publishing)
meterplex_invoices_generated_total — counter by type (full/prorated)
meterplex_payments_total — counter by status (succeeded/failed)
meterplex_entitlement_check_duration_seconds — histogram (the hot path)
meterplex_kafka_consumer_lag — gauge by consumer group
API design (if applicable)
Exposed via the same /metrics endpoint. No separate API.
Alternatives considered
- Log-based metrics — rejected. Structured logs are good for debugging but bad for real-time dashboards. Prometheus metrics are purpose-built for monitoring.
Additional context
Instrument at the service level, not the controller level. The producer/consumer services emit metrics directly.
Problem
HTTP metrics tell you the API is responding. They don't tell you the billing pipeline is healthy. We need metrics for business-critical operations.
Proposed solution
Add custom Prometheus metrics:
meterplex_usage_events_ingested_total— counter by tenant, feature, status (accepted/rejected/duplicate)meterplex_usage_events_validated_total— counter by result (valid/rejected/dead_letter)meterplex_usage_events_aggregated_total— countermeterplex_outbox_pending_count— gauge (current PENDING outbox rows)meterplex_outbox_publish_duration_seconds— histogrammeterplex_dead_letter_total— counter by stage (validation/aggregation/publishing)meterplex_invoices_generated_total— counter by type (full/prorated)meterplex_payments_total— counter by status (succeeded/failed)meterplex_entitlement_check_duration_seconds— histogram (the hot path)meterplex_kafka_consumer_lag— gauge by consumer groupAPI design (if applicable)
Exposed via the same
/metricsendpoint. No separate API.Alternatives considered
Additional context
Instrument at the service level, not the controller level. The producer/consumer services emit metrics directly.