Skip to main content

tuwunel_admin/debug/
runtime_interval.rs

1use tuwunel_core::Result;
2
3use crate::admin_command;
4
5#[cfg(tokio_unstable)]
6#[admin_command]
7pub(super) async fn runtime_interval(&self) -> Result {
8	let out = self
9		.services
10		.server
11		.metrics
12		.runtime_interval()
13		.map_or_else(
14			|| "Runtime metrics are not available.".to_owned(),
15			|metrics| format!("```rs\n{metrics:#?}\n```"),
16		);
17
18	self.write_str(&out).await
19}
20
21#[cfg(not(tokio_unstable))]
22#[admin_command]
23pub(super) async fn runtime_interval(&self) -> Result {
24	self.write_str("Runtime metrics require building with `tokio_unstable`.")
25		.await
26}