Expand description
A second decision layer for Spider Cloud requests.
spider-route picks the settings of a first attempt from rules. This
crate runs after the router and the request plan, when the request is
about to go out. It generates valid candidate edits to the request
parameters (generate), scores each for success, latency and credits
through a Scorer, and applies at most one edit set, only when it
passes validate() and the evidence Gate. Otherwise the request goes
out exactly as it was. Leaving it unchanged is always candidate zero and
the baseline every other candidate is measured against.
Like the router, it is sync, does no input or output, holds no clock,
reads no environment, and allocates nothing while it scores. With no model
compiled in, NoModel abstains and every request is kept.
§What never reaches a number
No host, domain, address or page body reaches a feature slot, a recorded
row or a public numeric type. The one place a resource identifier lives is
Identifier::pattern, which exists to be written into
network_blacklist and nowhere else.
§The request type
The request body is defined by the client crate, which depends on this one,
so this crate reads and writes it through the Params trait. The client
implements it for its own request type.
Re-exports§
pub use crate::artifact::embedded;embedded-modelpub use crate::artifact::cell_id;pub use crate::artifact::ArtifactError;pub use crate::artifact::Compact;pub use crate::artifact::ModelKind;pub use crate::artifact::MAX_WIDTH;pub use candidates::generate;pub use candidates::Candidate;pub use candidates::Context;pub use candidates::MAX_CANDIDATES;pub use candidates::MULTIPLIERS;pub use edit::Applied;pub use edit::Edit;pub use edit::EditError;pub use edit::EditSet;pub use edit::Op;pub use edit::Value;pub use edit::MAX_EDITS;pub use features::featurize_edit;pub use features::EditFeatures;pub use features::Input;pub use features::EDIT_DIM;pub use features::EDIT_FEATURE_VERSION;pub use gate::choose;pub use gate::Choice;pub use gate::Gate;pub use gate::Reason;pub use labels::byte_ratio;pub use labels::fields_ok;pub use labels::shingle_jaccard;pub use model::ModelVersion;pub use model::NoModel;pub use model::Score;pub use model::Scorer;pub use monitor::Estimate;pub use monitor::Monitor;pub use monitor::MonitorConfig;pub use monitor::Verdict;pub use observe::summarize;pub use observe::Identifier;pub use observe::Observation;pub use observe::ResourceSummary;pub use observe::MAX_IDENTIFIERS;pub use params::Params;pub use row::comparison_row;pub use row::Arm;pub use row::ComparisonRow;pub use row::EditDescriptor;pub use row::IdentDescriptor;pub use row::MemoryState;pub use row::CMP_ROW_VERSION;pub use schema::edit_code;pub use schema::Dependency;pub use schema::Group;pub use schema::Key;pub use schema::Kind;pub use schema::ParamSpec;pub use schema::Schema;pub use schema::KEEP_CODE;pub use schema::SCHEMA_VERSION;pub use validate::validate;pub use validate::Rejection;
Modules§
- artifact
- Version one numeric model artifacts. All integers and floats are little endian.
- candidates
- The edits worth scoring for one request.
- edit
- A change to a request, and writing it.
- features
- What a scorer is allowed to look at about an edit.
- gate
- Whether any candidate is worth applying.
- labels
- Whether a candidate arm returned what the baseline arm did.
- model
- The scoring boundary.
- monitor
- A tripwire on the success rate of applied edits.
- observe
- What is known about a site before an edit is chosen.
- params
- How this crate reads and writes a request.
- row
- The comparison row: one arm of one paired trial, as a line of JSON.
- schema
- Every request parameter, what it holds, and which ones may be learned.
- validate
- Whether a candidate may be applied at all, before anything scores it.