Skip to content

feat(sdk): Add Prometheus exposition format export #10

Description

@lowhung

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions