Crate metrics_dashboard

Crate metrics_dashboard 

Source
Expand description

This crate provide simple auto-generate dashboard for metric-rs crate. To intergrate to poem webserver, simple include to route like:

use metrics_dashboard::{build_dashboard_route, DashboardOptions, ChartType}; use poem::Route; let dashboard_options = DashboardOptions { custom_charts: vec![ ChartType::Line { metrics: vec![ "demo_live_time".to_string(), "demo_live_time_max".to_string(), ], desc: "Demo metric line".to_string(), unit: "Seconds".to_string(), }, ], include_default: true, }; let app = Route::new().nest("/dashboard/", build_dashboard_route(dashboard_options));

After init dashboard route, all of metrics defined metric will be exposed.

use metrics::{describe_counter, counter}; describe_counter!("demo_metric1", "Demo metric1"); counter!("demo_metric1").increment(1);

Re-exports§

pub use metrics;

Modules§

recorder

Structs§

DashboardOptions
Files
HttpMetricMiddleware
Middleware for tracing.

Enums§

ChartType

Functions§

build_dashboard_route
build_dashboard_route_with_recorder