1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Prometheus metrics endpoint.
//!
//! Exposes all collected metrics in the Prometheus text exposition format.
//! Only available when the `prometheus` feature is enabled.
//!
//! # Endpoint
//!
//! | Method | Path | Description |
//! |--------|------|-------------|
//! | `GET` | `/api/v1/metrics` | Returns metrics in Prometheus text format |
//!
//! # Metrics exposed
//!
//! All metrics defined in [`ironflow_core::metric_names`] are available,
//! including run counters, step histograms, agent cost/token gauges,
//! worker activity, and API request latency.
//!
//! # Grafana example
//!
//! ```promql
//! # Run throughput (completed runs per minute)
//! rate(ironflow_runs_total{status="completed"}[5m])
//!
//! # P99 run duration
//! histogram_quantile(0.99, rate(ironflow_run_duration_seconds_bucket[5m]))
//!
//! # Agent cost rate (USD per hour)
//! rate(ironflow_agent_cost_usd_total[1h])
//! ```
use State;
use CONTENT_TYPE;
use ;
use PrometheusHandle;
/// Handler for `GET /api/v1/metrics`.
///
/// Returns all registered Prometheus metrics in text exposition format.
///
/// # Examples
///
/// ```no_run
/// use axum::Router;
/// use axum::routing::get;
/// use metrics_exporter_prometheus::{PrometheusBuilder, PrometheusHandle};
///
/// # fn example() {
/// let handle = PrometheusBuilder::new()
/// .install_recorder()
/// .expect("failed to install recorder");
///
/// let app: Router<PrometheusHandle> = Router::new()
/// .route("/metrics", get(ironflow_api::routes::metrics::metrics));
/// # }
/// ```
pub async