30 lines
806 B
Rust
30 lines
806 B
Rust
//! The observability concern: the Grafana alerts route, the held-deploy
|
|
//! gauge, the OTLP HTTP client and the forge metrics helpers.
|
|
|
|
pub(crate) mod alerts;
|
|
pub(crate) mod held_deploys;
|
|
pub(crate) mod otel_http_client;
|
|
pub(crate) mod vcs_metrics;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use axum::extract::FromRef;
|
|
|
|
use crate::routes::AppState;
|
|
|
|
/// What the alerts route may reach of [`AppState`]: Grafana's alerts client.
|
|
///
|
|
/// Derived per request from [`AppState`] (`FromRef`), so the field is a clone
|
|
/// of the same `Arc` and nothing is held twice.
|
|
#[derive(Clone)]
|
|
pub(crate) struct AlertsState {
|
|
pub(crate) alerts: Option<Arc<alerts::Grafana>>,
|
|
}
|
|
|
|
impl FromRef<AppState> for AlertsState {
|
|
fn from_ref(state: &AppState) -> Self {
|
|
Self {
|
|
alerts: state.alerts.clone(),
|
|
}
|
|
}
|
|
}
|