Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
rustdocflags = ["--cfg", "tokio_unstable"]
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ waymark-tick-loop = { path = "crates/lib/tick-loop" }
waymark-timed = { path = "crates/lib/timed" }
waymark-timed-channel = { path = "crates/lib/timed-channel" }
waymark-timed-future = { path = "crates/lib/timed-future" }
waymark-tokio-metrics-bringup = { path = "crates/lib/tokio-metrics-bringup" }
waymark-utils-futures = { path = "crates/lib/utils-futures" }
waymark-utils-tokio-channel = { path = "crates/lib/utils-tokio-channel" }
waymark-webapp-backend = { path = "crates/lib/webapp-backend" }
Expand Down Expand Up @@ -107,6 +108,7 @@ syn = "2"
tera = "1"
thiserror = "2"
tokio = "1"
tokio-metrics = "0.4"
tokio-stream = "0.1"
tokio-util = "0.7"
tonic = "0.11"
Expand Down
1 change: 1 addition & 0 deletions crates/bin/start-workers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ waymark-proto = { workspace = true }
waymark-runloop = { workspace = true }
waymark-scheduler-loop = { workspace = true }
waymark-scheduler-loop-core = { workspace = true }
waymark-tokio-metrics-bringup = { workspace = true }
waymark-webapp-bringup = { workspace = true }
waymark-worker-remote = { workspace = true }
waymark-worker-status-reporter = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions crates/bin/start-workers/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ async fn main() -> Result<()> {
let metrics_addr: std::net::SocketAddr = envfury::or_parse("METRICS_ADDR", "0.0.0.0:9118")?;
waymark_prometheus_exporter_bringup::spawn_and_install_recorder(metrics_addr)?;

let _task_monitor = waymark_tokio_metrics_bringup::bringup(env!("CARGO_BIN_NAME"));

// Load configuration and announce startup.
let config = WorkerConfig::from_env()?;

Expand Down
10 changes: 10 additions & 0 deletions crates/lib/tokio-metrics-bringup/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "waymark-tokio-metrics-bringup"
edition = "2024"
version.workspace = true
publish.workspace = true

[dependencies]
metrics = { workspace = true }
tokio = { workspace = true, features = ["rt"] }
tokio-metrics = { workspace = true, features = ["metrics-rs-integration"] }
31 changes: 31 additions & 0 deletions crates/lib/tokio-metrics-bringup/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
fn make_metric_name_transformer(
executable_name: &'static str,
) -> impl Fn(&'static str) -> metrics::Key + Send + Sync + Copy + 'static {
move |name| {
metrics::Key::from_parts(
metrics::KeyName::from_const_str(name),
&[("application", executable_name)],
)
}
}

// TODO: update spawns when we have a proper
// task management / registration system.
pub fn bringup(executable_name: &'static str) -> tokio_metrics::TaskMonitor {
let metric_name_transformer = make_metric_name_transformer(executable_name);

tokio::spawn(
tokio_metrics::RuntimeMetricsReporterBuilder::default()
.with_metrics_transformer(metric_name_transformer)
.describe_and_run(),
);

let task_monitor = tokio_metrics::TaskMonitor::new();

tokio::spawn(
tokio_metrics::TaskMetricsReporterBuilder::new(metric_name_transformer)
.describe_and_run(task_monitor.clone()),
);

task_monitor
}
Loading