Skip to content

Commit

Permalink
compute_ctl: Add more detailed tracing spans to startup subroutines (#…
Browse files Browse the repository at this point in the history
…10979)

In local dev environment, these steps take around 100 ms, and they are
in the critical path of a compute startup on a compute pool hit. I don't
know if it's like that in production, but as first step, add tracing
spans to the functions so that they can be measured more easily.
  • Loading branch information
hlinnaka authored Feb 26, 2025
1 parent 3684162 commit 43b109a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions compute_tools/src/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ impl ComputeNode {

// Fast path for sync_safekeepers. If they're already synced we get the lsn
// in one roundtrip. If not, we should do a full sync_safekeepers.
#[instrument(skip_all)]
pub fn check_safekeepers_synced(&self, compute_state: &ComputeState) -> Result<Option<Lsn>> {
let start_time = Utc::now();

Expand Down
2 changes: 2 additions & 0 deletions compute_tools/src/disk_quota.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use anyhow::Context;
use tracing::instrument;

pub const DISK_QUOTA_BIN: &str = "/neonvm/bin/set-disk-quota";

/// If size_bytes is 0, it disables the quota. Otherwise, it sets filesystem quota to size_bytes.
/// `fs_mountpoint` should point to the mountpoint of the filesystem where the quota should be set.
#[instrument]
pub fn set_disk_quota(size_bytes: u64, fs_mountpoint: &str) -> anyhow::Result<()> {
let size_kb = size_bytes / 1024;
// run `/neonvm/bin/set-disk-quota {size_kb} {mountpoint}`
Expand Down
3 changes: 2 additions & 1 deletion compute_tools/src/swap.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::path::Path;

use anyhow::{anyhow, Context};
use tracing::warn;
use tracing::{instrument, warn};

pub const RESIZE_SWAP_BIN: &str = "/neonvm/bin/resize-swap";

#[instrument]
pub fn resize_swap(size_bytes: u64) -> anyhow::Result<()> {
// run `/neonvm/bin/resize-swap --once {size_bytes}`
//
Expand Down

1 comment on commit 43b109a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7907 tests run: 7518 passed, 0 failed, 389 skipped (full report)


Flaky tests (4)

Postgres 17

Postgres 16

Postgres 15

Code coverage* (full report)

  • functions: 32.8% (8634 of 26357 functions)
  • lines: 48.6% (73092 of 150406 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
43b109a at 2025-02-26T12:33:07.929Z :recycle:

Please sign in to comment.