mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
http: enable running prometheus endpoint
This commit is contained in:
parent
32884aae36
commit
b41c565e38
1 changed files with 16 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
use anyhow::Context;
|
||||||
use aquatic_common::{
|
use aquatic_common::{
|
||||||
access_list::update_access_list,
|
access_list::update_access_list,
|
||||||
cpu_pinning::{
|
cpu_pinning::{
|
||||||
|
|
@ -30,6 +31,21 @@ const SHARED_CHANNEL_SIZE: usize = 1024;
|
||||||
pub fn run(config: Config) -> ::anyhow::Result<()> {
|
pub fn run(config: Config) -> ::anyhow::Result<()> {
|
||||||
let mut signals = Signals::new([SIGUSR1, SIGTERM])?;
|
let mut signals = Signals::new([SIGUSR1, SIGTERM])?;
|
||||||
|
|
||||||
|
#[cfg(feature = "prometheus")]
|
||||||
|
if config.metrics.run_prometheus_endpoint {
|
||||||
|
use metrics_exporter_prometheus::PrometheusBuilder;
|
||||||
|
|
||||||
|
PrometheusBuilder::new()
|
||||||
|
.with_http_listener(config.metrics.prometheus_endpoint_address)
|
||||||
|
.install()
|
||||||
|
.with_context(|| {
|
||||||
|
format!(
|
||||||
|
"Install prometheus endpoint on {}",
|
||||||
|
config.metrics.prometheus_endpoint_address
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
|
||||||
let state = State::default();
|
let state = State::default();
|
||||||
|
|
||||||
update_access_list(&config.access_list, &state.access_list)?;
|
update_access_list(&config.access_list, &state.access_list)?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue