Skip to content

feat: per-stage indexing timings from the optimizations endpoint#152

Open
tellet-q wants to merge 1 commit into
devfrom
feat/optimization-stage-timings
Open

feat: per-stage indexing timings from the optimizations endpoint#152
tellet-q wants to merge 1 commit into
devfrom
feat/optimization-stage-timings

Conversation

@tellet-q

@tellet-q tellet-q commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Indexing was a single number — wait_secs — so a slow index build told you nothing about what was slow. Qdrant already tracks the breakdown; it just isn't exposed over gRPC. This reads it and reports it. No new subcommand, no new workflow. bfb upload and the legacy run already wait for a green index before exiting; that wait now also reports what it cost:

  bfb upload --file config.yaml -n 1M --json results.json
                                                                                                                                                                                                                                              
  Index ready in 20.255 seconds
  --- Optimization stages (1 completed, 18.068 s total) ---
  vector_index/main_graph:      16.663360 s total over 1 run(s), max 16.663360 s
  copy_data:                     0.336660 s total over 1 run(s), max 0.336660 s
  payload_index/keyword:color:   0.133206 s total over 1 run(s), max 0.133206 s

Attribution is baseline-diffed. The server exposes a rolling window of the last 16 completed optimizations, not the ones belonging to your run. So bfb snapshots the completed UUIDs before the phase and excludes them afterwards — otherwise a run would cheerfully report an earlier one's work as its own.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

@tellet-q tellet-q force-pushed the feat/optimization-stage-timings branch from 65d1064 to 93336b3 Compare July 14, 2026 07:19
Base automatically changed from feat/phase-subcommands to dev July 14, 2026 08:52
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tellet-q tellet-q force-pushed the feat/optimization-stage-timings branch from 93336b3 to d8539df Compare July 14, 2026 09:22
@tellet-q tellet-q marked this pull request as ready for review July 14, 2026 09:26
@tellet-q tellet-q requested a review from Copilot July 14, 2026 09:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds per-stage indexing/optimization timing attribution to the existing “wait for green index” phase by reading Qdrant’s REST-only /collections/{collection}/optimizations endpoint, baseline-diffing completed optimization UUIDs, printing a stage breakdown, and persisting the report into the JSON results document.

Changes:

  • Introduces a REST-backed optimizations module that fetches and aggregates optimization progress-tree stage timings with baseline exclusion.
  • Extends results.index to optionally include optimizations (per-stage aggregates) alongside wait_secs.
  • Adds --skip-server-stats to disable the REST-only optimization breakdown and updates docs/fixtures accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/fixtures/optimizations_completed.json Adds a real-server JSON fixture used to validate parsing and stage aggregation.
src/results.rs Extends IndexPhase to optionally store the optimization-stage report in JSON output.
src/optimizations.rs New module to fetch, baseline-diff, aggregate, and print per-stage optimization timings from Qdrant REST.
src/main.rs Captures optimization baseline before upload, waits for green index, then fetches/prints/stores stage breakdown.
src/args/mod.rs Adds --skip-server-stats flag to disable REST-only extras.
README.md Documents the new per-stage indexing timing output and JSON field location.
DEVELOPMENT.md Updates file layout documentation to include the new optimizations.rs module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main.rs
Comment on lines +66 to +72
tokio::task::spawn_blocking(move || {
optimizations::baseline(&rest_uri, &collection, api_key.as_deref())
})
.await
.ok()
.and_then(Result::ok)
.unwrap_or_default()
Comment thread src/optimizations.rs
Comment on lines +276 to +280
let agent = ureq::Agent::new_with_defaults();
let mut request = agent.get(&url);
if let Some(key) = api_key {
request = request.header("api-key", key);
}
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.

2 participants