refactor: emit panic metrics for server types
Configures the long-running / server modes to emit panic metrics.pull/24376/head
parent
49c38c2976
commit
c363242902
|
@ -370,7 +370,7 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
info!(?ingester_addresses, "starting querier");
|
||||
let querier = create_querier_server_type(
|
||||
&common_state,
|
||||
metrics,
|
||||
Arc::clone(&metrics),
|
||||
catalog,
|
||||
object_store,
|
||||
time_provider,
|
||||
|
@ -388,5 +388,5 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
Service::create_grpc_only(querier, &querier_run_config),
|
||||
];
|
||||
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(common_state, services, metrics).await?)
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ pub async fn command(config: Config) -> Result<(), Error> {
|
|||
|
||||
let server_type = create_compactor_server_type(
|
||||
&common_state,
|
||||
metric_registry,
|
||||
Arc::clone(&metric_registry),
|
||||
catalog,
|
||||
object_store,
|
||||
exec,
|
||||
|
@ -103,5 +103,5 @@ pub async fn command(config: Config) -> Result<(), Error> {
|
|||
info!("starting compactor");
|
||||
|
||||
let services = vec![Service::create(server_type, common_state.run_config())];
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(common_state, services, metric_registry).await?)
|
||||
}
|
||||
|
|
|
@ -130,5 +130,10 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
));
|
||||
|
||||
let services = vec![Service::create(server_type, common_state.run_config())];
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(
|
||||
common_state,
|
||||
services,
|
||||
Arc::new(metric::Registry::default()),
|
||||
)
|
||||
.await?)
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
let exec = Arc::new(Executor::new(config.query_exec_thread_count));
|
||||
let server_type = create_ingester_server_type(
|
||||
&common_state,
|
||||
metric_registry,
|
||||
Arc::clone(&metric_registry),
|
||||
catalog,
|
||||
object_store,
|
||||
exec,
|
||||
|
@ -101,5 +101,5 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
info!("starting ingester");
|
||||
|
||||
let services = vec![Service::create(server_type, common_state.run_config())];
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(common_state, services, metric_registry).await?)
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use ioxd_common::Service;
|
||||
use ioxd_common::{grpc_listener, http_listener, serve, server_type::CommonServerState};
|
||||
use observability_deps::tracing::{error, info};
|
||||
|
@ -66,7 +68,11 @@ fn build_malloc_conf() -> String {
|
|||
///
|
||||
/// Due to its invasive nature (install global panic handling,
|
||||
/// logging, etc) this function should not be used during unit tests.
|
||||
pub async fn main(common_state: CommonServerState, services: Vec<Service>) -> Result<()> {
|
||||
pub async fn main(
|
||||
common_state: CommonServerState,
|
||||
services: Vec<Service>,
|
||||
metrics: Arc<metric::Registry>,
|
||||
) -> Result<()> {
|
||||
let git_hash = env!("GIT_HASH", "starting influxdb_iox server");
|
||||
let num_cpus = num_cpus::get();
|
||||
let build_malloc_conf = build_malloc_conf();
|
||||
|
@ -98,7 +104,7 @@ pub async fn main(common_state: CommonServerState, services: Vec<Service>) -> Re
|
|||
// lifetime of the program - this is actually a good thing, as it prevents
|
||||
// the panic handler from being removed while unwinding a panic (which in
|
||||
// turn, causes a panic - see #548)
|
||||
let f = SendPanicsToTracing::new();
|
||||
let f = SendPanicsToTracing::new().with_metrics(&*metrics);
|
||||
std::mem::forget(f);
|
||||
|
||||
// Register jemalloc metrics
|
||||
|
|
|
@ -89,7 +89,7 @@ pub async fn command(config: Config) -> Result<(), Error> {
|
|||
let exec = Arc::new(Executor::new(num_threads));
|
||||
let server_type = create_querier_server_type(
|
||||
&common_state,
|
||||
metric_registry,
|
||||
Arc::clone(&metric_registry),
|
||||
catalog,
|
||||
object_store,
|
||||
time_provider,
|
||||
|
@ -101,5 +101,5 @@ pub async fn command(config: Config) -> Result<(), Error> {
|
|||
info!("starting querier");
|
||||
|
||||
let services = vec![Service::create(server_type, common_state.run_config())];
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(common_state, services, metric_registry).await?)
|
||||
}
|
||||
|
|
|
@ -159,5 +159,10 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
));
|
||||
|
||||
let services = vec![Service::create(server_type, common_state.run_config())];
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(
|
||||
common_state,
|
||||
services,
|
||||
Arc::new(metric::Registry::default()),
|
||||
)
|
||||
.await?)
|
||||
}
|
||||
|
|
|
@ -96,5 +96,5 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
|
||||
info!("starting router2");
|
||||
let services = vec![Service::create(server_type, common_state.run_config())];
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(common_state, services, metrics).await?)
|
||||
}
|
||||
|
|
|
@ -61,5 +61,10 @@ pub async fn command(config: Config) -> Result<()> {
|
|||
));
|
||||
|
||||
let services = vec![Service::create(server_type, common_state.run_config())];
|
||||
Ok(main::main(common_state, services).await?)
|
||||
Ok(main::main(
|
||||
common_state,
|
||||
services,
|
||||
Arc::new(metric::Registry::default()),
|
||||
)
|
||||
.await?)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue