-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to plumb plugins up to the CLI flags (#11)
Attempt to plumb plugins up to the CLI flags ---------- Add fmt::Display to ResponseStatusCode. ---------- Dirt simple PR to implement displaying of response codes. ---------- Remove dead contingency table code. This was dead code because I reimplemented contingency tables in a better way. ------------- Fix Type Incompatibilities between Actors I had the type signatures incorrect for the actors. Some took Observation, other T, and the incompatibility is that an Observation is a Group + T, so DecisionEngines were actually able to be constructed. This commit fixes the issue and adds a small smoke test to construct a fake DecisionEngine as proof. -------- Implement Chi Square engine and add different types of contingency tables.
- Loading branch information
1 parent
367c263
commit a269065
Showing
23 changed files
with
545 additions
and
129 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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,45 @@ | ||
use crate::{ | ||
metrics::ResponseStatusCode, | ||
stats::{EmpiricalTable, ExpectationTable, Group, Observation}, | ||
}; | ||
|
||
use super::DecisionEngine; | ||
|
||
/// The [ChiSquareEngine] uses the Chi Square statistical | ||
/// significance test to determine whether the canary should be promoted or not. | ||
#[derive(Default)] | ||
pub struct ChiSquareEngine { | ||
control_data: ExpectationTable<ResponseStatusCode>, | ||
experimental_data: EmpiricalTable<ResponseStatusCode>, | ||
} | ||
|
||
impl DecisionEngine<ResponseStatusCode> for ChiSquareEngine { | ||
// TODO: From writing this method, it's apparent there should be a Vec implementation | ||
// that adds Vec::len() to the total and concats the vectors together, because | ||
// otherwise we're wasting a ton of cycles just incrementing counters. | ||
fn add_observation(&mut self, observation: Observation<ResponseStatusCode>) { | ||
match observation.group { | ||
Group::Control => { | ||
// • Increment the number of observations for this category. | ||
self.control_data.increment(observation.outcome); | ||
} | ||
Group::Experimental => { | ||
// • Increment the number of observations in the canary contingency table. | ||
self.experimental_data.increment(observation.outcome); | ||
// • Then, let the control contingency table know that there was | ||
// another experimental observation. | ||
self.control_data.increment_experimental_total(); | ||
} | ||
} | ||
} | ||
|
||
fn compute(&mut self) -> Option<super::Action> { | ||
todo!() | ||
} | ||
} | ||
|
||
impl ChiSquareEngine { | ||
pub fn new() -> Self { | ||
Self::default() | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,18 @@ | ||
use crate::Pipeline; | ||
use miette::Result; | ||
|
||
#[derive(Default)] | ||
pub struct Deploy; | ||
|
||
impl Deploy { | ||
pub fn new() -> Self { | ||
Self | ||
} | ||
|
||
/// deploy the canary, monitoring it, and ultimately promoting | ||
/// or yanking the deployment. | ||
pub async fn dispatch(self) -> Result<()> { | ||
// • Set up our deployment pipeline. | ||
Pipeline::run().await | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
/// A subcommand to deploy the canary, and self-promote it as we gain | ||
/// statistical confidence in its correctness. | ||
pub use deploy::Deploy; | ||
/// A subcommand to print the version of this executable. | ||
pub use version::Version; | ||
|
||
mod deploy; | ||
mod version; |
This file contains 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
This file contains 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.