Skip to content

[adapters] Expose pipeline process swap usage as a Prometheus metric#6383

Open
sjhddh wants to merge 1 commit into
feldera:mainfrom
sjhddh:feat/swap-usage-metric
Open

[adapters] Expose pipeline process swap usage as a Prometheus metric#6383
sjhddh wants to merge 1 commit into
feldera:mainfrom
sjhddh:feat/swap-usage-metric

Conversation

@sjhddh
Copy link
Copy Markdown

@sjhddh sjhddh commented Jun 3, 2026

Describe Manual Test Plan

Adds a process_swap_bytes gauge to the pipeline process metrics, reporting how many bytes of the process's memory are currently swapped out. A nonzero value tells operators the process is swapping, which degrades performance, as requested in #6382.

On Linux the value is read from the VmSwap field of /proc/self/status (reported in kB and converted to bytes). On non-Linux platforms (e.g. macOS), or when the field is unavailable, the metric is omitted rather than reported as a misleading zero — consistent with how the other process_* gauges in process_metrics are only emitted when present.

Verified locally:

  • cargo fmt --all --check — clean
  • cargo clippy -p dbsp_adapters — no new warnings
  • cargo build -p dbsp_adapters — builds
  • cargo test -p dbsp_adapters --lib server::metrics — 3 passed, incl. the new parse_vm_swap unit test (present / missing / zero / malformed VmSwap).

The Linux /proc/self/status read path itself was not exercised at runtime (developed on macOS), but the VmSwap parser is unit-tested cross-platform.

Closes #6382

Add a `process_swap_bytes` gauge to the pipeline process metrics,
reporting how much of the process's memory is currently swapped out.
A nonzero value tells operators the process is swapping, which degrades
performance.

On Linux the value is read from the `VmSwap` field of
`/proc/self/status` (reported in kB and converted to bytes). On
non-Linux platforms, or when the field is unavailable, the metric is
omitted rather than reported as a misleading zero. Includes a unit test
for the `VmSwap` parser covering the present, missing, zero, and
malformed cases.

Closes feldera#6382

Signed-off-by: sjhddh <151469562+sjhddh@users.noreply.github.com>
@mihaibudiu mihaibudiu requested a review from blp June 3, 2026 18:35
@blp
Copy link
Copy Markdown
Member

blp commented Jun 3, 2026

It would be good to update the documentation in docs.feldera.com/docs/operations/metrics.md

Copy link
Copy Markdown

@mythical-fred mythical-fred left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alert when a pipeline process is swapping

4 participants