-
Notifications
You must be signed in to change notification settings - Fork 0
Share execution configuration across run paths (#134) #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
leynos
wants to merge
4
commits into
main
Choose a base branch
from
issue-134-introduce-a-shared-execution-config-thread-hnsw-params-derive-memory-estimates-centralise-run-preconditions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3f7727c
Share execution configuration across run paths (#134)
leynos 03cbf61
Harden batch HNSW configuration handling (#134)
leynos 864e215
Instrument bounded batch execution metrics (#134)
leynos a8845e0
Account for configured HNSW cache capacity (#134)
leynos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| //! Bounded metrics emitted by the one-shot clustering execution path. | ||
| //! | ||
| //! This module owns the stable batch metric vocabulary. It accepts only | ||
| //! resource values and bounded labels, keeping source names and payload data | ||
| //! outside the metrics surface. | ||
|
|
||
| use crate::Result; | ||
|
|
||
| const RUNS_TOTAL: &str = "chutoro.batch.runs_total"; | ||
| #[cfg(feature = "cpu")] | ||
| const MAX_CONNECTIONS: &str = "chutoro.batch.max_connections"; | ||
| #[cfg(feature = "cpu")] | ||
| const EFFECTIVE_EF_CONSTRUCTION: &str = "chutoro.batch.effective_ef_construction"; | ||
| #[cfg(feature = "cpu")] | ||
| const ESTIMATED_BYTES: &str = "chutoro.batch.estimated_bytes"; | ||
| #[cfg(feature = "cpu")] | ||
| const MEMORY_LIMIT_BYTES: &str = "chutoro.batch.memory_limit_bytes"; | ||
|
|
||
| /// Records the final outcome of a one-shot batch run. | ||
| pub(crate) fn record_outcome<T>(backend: &'static str, result: &Result<T>) { | ||
| let (outcome, error_code) = match result { | ||
| Ok(_) => ("success", "none"), | ||
| Err(error) => ("error", error.code().as_str()), | ||
| }; | ||
|
|
||
| metrics::describe_counter!( | ||
| RUNS_TOTAL, | ||
| metrics::Unit::Count, | ||
| "Total one-shot batch runs by backend, outcome, and stable error code." | ||
| ); | ||
| metrics::counter!( | ||
| RUNS_TOTAL, | ||
| "backend" => backend, | ||
| "outcome" => outcome, | ||
| "error_code" => error_code | ||
| ) | ||
| .increment(1); | ||
| } | ||
|
|
||
| /// Records CPU HNSW and memory observations for a one-shot batch run. | ||
| #[cfg(feature = "cpu")] | ||
| pub(crate) fn record_cpu_resources( | ||
| max_connections: usize, | ||
| effective_ef_construction: usize, | ||
| estimated_bytes: u64, | ||
| memory_limit_bytes: Option<u64>, | ||
| ) { | ||
| metrics::describe_histogram!( | ||
| MAX_CONNECTIONS, | ||
| metrics::Unit::Count, | ||
| "Configured CPU HNSW maximum connections for one-shot batch runs." | ||
| ); | ||
| metrics::describe_histogram!( | ||
| EFFECTIVE_EF_CONSTRUCTION, | ||
| metrics::Unit::Count, | ||
| "Dataset-bounded CPU HNSW construction search width for one-shot batch runs." | ||
| ); | ||
| metrics::describe_histogram!( | ||
| ESTIMATED_BYTES, | ||
| metrics::Unit::Bytes, | ||
| "Estimated peak bytes for one-shot CPU batch runs." | ||
| ); | ||
| metrics::histogram!(MAX_CONNECTIONS, "backend" => "cpu").record(max_connections as f64); | ||
| metrics::histogram!(EFFECTIVE_EF_CONSTRUCTION, "backend" => "cpu") | ||
| .record(effective_ef_construction as f64); | ||
| metrics::histogram!(ESTIMATED_BYTES, "backend" => "cpu").record(estimated_bytes as f64); | ||
|
|
||
| if let Some(limit) = memory_limit_bytes { | ||
| metrics::describe_histogram!( | ||
| MEMORY_LIMIT_BYTES, | ||
| metrics::Unit::Bytes, | ||
| "Configured memory-limit bytes for one-shot CPU batch runs." | ||
| ); | ||
| metrics::histogram!(MEMORY_LIMIT_BYTES, "backend" => "cpu").record(limit as f64); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.