Crate metrics_rs_dashboard_actix

Crate metrics_rs_dashboard_actix 

Source
Expand description

§Metrics Module

This module provides comprehensive Prometheus metrics integration for Actix web applications. It enables robust monitoring capabilities with automatic metric collection, exposition, and visualization through an integrated dashboard.

§Features

  • Prometheus Integration: Full support for collecting and exposing metrics in Prometheus format
  • Interactive Dashboard: Built-in web UI for visualizing metrics in real-time
  • Rate Metrics: Automatic calculation and tracking of per-second rates from counter values
  • Customizable Histograms: Fine-grained control over histogram bucket configuration
  • Easy Integration: Seamlessly integrates with Actix web applications via a simple API
  • Thread-Safe: Designed for concurrent access with proper synchronization
  • Low Overhead: Minimal performance impact on your application

§Architecture

The module uses a multi-recorder approach with a fanout pattern to capture both metric values and their associated metadata (like units). This information is then made available both in Prometheus format for scraping and through a dashboard for human-readable visualization.

§Getting Started

Simply add the metrics scope to your Actix application as shown in the examples below.

Re-exports§

pub use metrics;
pub use metrics_exporter_prometheus;
pub use metrics_util;

Macros§

absolute_counter_with_rate
Macro for recording an absolute counter value with automatic rate tracking
counter_with_rate
Macro for recording a counter with automatic rate tracking

Structs§

DashboardInput
Configuration options for the metrics dashboard
RateTracker
Rate tracking utility for calculating per-second rates from counter values
get_dashboard
Handler for the metrics dashboard index page
get_dashboard_assets
Handler for serving dashboard assets (JS, CSS, etc.)
get_prometheus_metrics
Endpoint for exposing Prometheus metrics

Functions§

create_metrics_actx_scope
Creates an Actix web scope for metrics endpoints
update_rate_tracker
Updates a rate tracker and returns the calculated rate