mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-16 18:02:56 +00:00
pageserver: remove bare tokio::spawn
Commit ddb9c2fe9 added this task, which is launched
with tokio::spawn rather than task_mgr::spawn, and is
not wrapped in a tracing Instrumented<>.
While the task doesn't overtly do any logging, for
consistency we should spawn all our tasks via the wrapper: in
future this task might be extended to e.g. emit log lines that
we would expect to have the proper tracing spans.
This commit is contained in:
@@ -2076,7 +2076,14 @@ impl Tenant {
|
||||
) -> Tenant {
|
||||
let (state, mut rx) = watch::channel(state);
|
||||
|
||||
tokio::spawn(async move {
|
||||
task_mgr::spawn(
|
||||
task_mgr::BACKGROUND_RUNTIME.handle(),
|
||||
TaskKind::MetricsCollection,
|
||||
Some(tenant_id),
|
||||
None,
|
||||
&format!("state metrics collector for tenant {tenant_id}"),
|
||||
false,
|
||||
async move {
|
||||
let tid = tenant_id.to_string();
|
||||
|
||||
fn inspect_state(state: &TenantState) -> ([&'static str; 1], bool) {
|
||||
@@ -2126,7 +2133,10 @@ impl Tenant {
|
||||
.inc();
|
||||
}
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
.instrument(info_span!("state_metrics", tenant_id = %tenant_id)),
|
||||
);
|
||||
|
||||
Tenant {
|
||||
tenant_id,
|
||||
|
||||
Reference in New Issue
Block a user