oxidecomputer / oxidecomputer/omicron

Replace bespoke type for yielding a bunch of futures on an interval in the `KstatSampler`

Open
#9,273 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
572
Forks
97
Avg merge
2d 12h
Merged PRs (30d)
96

Description

The KstatSampler is designed to sample a bunch of underlying kstats on independent intervals. To do that, it uses a FuturesUnordered with a bunch of little copies of this type:

https://github.com/oxidecomputer/omicron/blob/af3b89ffce69ee6f3a3515db53bd29b9a8a8f01d/oximeter/instruments/src/kstat/esampler.rs#L235

That yields the ID of the target to sample, ordered by their deadlines. This is really a bespoke version of the DelayQueue type from the tokio_utils crate. We should replace all our custom types and machinery with this, which will reduce the code and probably perform better. For example, right now we need to move around the whole set of futures when one is updated, because you can't index into a FuturesUnordered.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in oximeter/instruments/src/kstat/esampler.rs around the bespoke future type linked in the issue, and inspect how KstatSampler schedules and updates sampling deadlines. Compare that machinery with tokio_util::time::DelayQueue. Done means the custom scheduling types and machinery are replaced while target IDs remain yielded in deadline order and updated intervals continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.