Summary
Add support for exporting metrics in Prometheus text-based exposition format, enabling scraping by Prometheus or compatible monitoring systems.
Proposed Solution
- Add new
prometheus feature flag to buswatch-sdk
- Create
prometheus.rs module with:
PrometheusConfig builder for configuration
PrometheusExporter for storing and rendering metrics
format_prometheus() function to convert snapshots to Prometheus format
- Add
Output::prometheus() variant
Metrics to Export
buswatch_read_count (counter) - Total messages read
buswatch_write_count (counter) - Total messages written
buswatch_read_backlog (gauge) - Unread message count
buswatch_read_pending_seconds (gauge) - Read wait time
buswatch_write_pending_seconds (gauge) - Write wait time
buswatch_read_rate_per_second (gauge) - Read throughput
buswatch_write_rate_per_second (gauge) - Write throughput
Labels
All metrics should include module and topic labels.
Summary
Add support for exporting metrics in Prometheus text-based exposition format, enabling scraping by Prometheus or compatible monitoring systems.
Proposed Solution
prometheusfeature flag to buswatch-sdkprometheus.rsmodule with:PrometheusConfigbuilder for configurationPrometheusExporterfor storing and rendering metricsformat_prometheus()function to convert snapshots to Prometheus formatOutput::prometheus()variantMetrics to Export
buswatch_read_count(counter) - Total messages readbuswatch_write_count(counter) - Total messages writtenbuswatch_read_backlog(gauge) - Unread message countbuswatch_read_pending_seconds(gauge) - Read wait timebuswatch_write_pending_seconds(gauge) - Write wait timebuswatch_read_rate_per_second(gauge) - Read throughputbuswatch_write_rate_per_second(gauge) - Write throughputLabels
All metrics should include
moduleandtopiclabels.