MoonBit streaming sketch toolkit for approximate analytics, drift checks, and compact data reports.
cd C:\Users\Lenovo\Desktop\Hot100\moon-sketch-kit
moon update
moon check
moon test.\scripts\verify.ps1moon run cmd/main -- report "login view login cart checkout login"moon run cmd/main -- json "login view login cart checkout login"moon run cmd/main -- windows "login login view | view cart cart checkout | checkout refund refund"moon run cmd/main -- weighted "login:12 view:7 checkout:3 refund:1"moon run cmd/main -- histogram "12 18 21 21 35 89" 0 100 10
moon run cmd/main -- quantile "12 18 21 21 35 89"moon run cmd/main -- gate "login view login cart" "login login checkout refund"moon run cmd/main -- budget "login view login cart checkout refund user42 user43" 6.\scripts\demo.ps1///|
fn main {
let report = @sketch.windowed_report_from_text(
"login login view | view cart checkout | refund refund checkout",
)
println(@sketch.windowed_report_markdown(report))
}moon run examples/basic
moon run examples/windowed
moon run examples/budgetpub(all) struct CountMinErrorReport {
total : Int
max_overestimate : Int
average_overestimate : Double
rows : Array[CountMinError]
} derive(Eq, Debug)pub(all) struct SketchGateReport {
passed : Bool
policy : SketchQualityPolicy
drift : StreamDrift
issues : Array[SketchGateIssue]
} derive(Eq, Debug)pub(all) struct SketchReport {
item_count : Int
unique_count : Int
hll_estimate : Double
topk : SpaceSavingTopK
sampler : ReservoirSampler
} derive(Eq, Debug)pub(all) struct StreamDrift {
baseline : StreamSnapshot
candidate : StreamSnapshot
event_delta : Int
unique_delta : Int
top_overlap : Double
minhash_similarity : Double
} derive(Eq, Debug)pub(all) struct TokenProfile {
total : Int
unique : Int
numeric : Int
alphabetic : Int
alphanumeric : Int
mixed : Int
min_length : Int
max_length : Int
average_length : Double
length_histogram : IntHistogram
prefix_topk : Array[TopKItem]
} derive(Eq, Debug)pub(all) struct WeightedStreamSummary {
event_rows : Int
total_weight : Int
unique_keys : Int
count_min : CountMinSketch
exact : ExactCounter
topk : Array[TopKItem]
} derive(Eq, Debug)pub(all) struct WindowedStreamReport {
windows : Array[WindowSnapshot]
changes : Array[WindowChange]
total_events : Int
max_event_spike : Int
min_similarity : Double
} derive(Eq, Debug)fn count_min_error_report(items : Array[String], probes : Array[String], width : Int, depth : Int) -> CountMinErrorReportfn evaluate_stream_gate(baseline_name : String, baseline_input : String, candidate_name : String, candidate_input : String, policy : SketchQualityPolicy) -> SketchGateReportfn evaluate_stream_gate_default(baseline_input : String, candidate_input : String) -> SketchGateReportfn sketch_budget_plan(expected_events : Int, expected_unique : Int, accuracy_level : Int) -> SketchBudgetPlanfn sketch_gate_issue(severity : String, rule : String, metric : String, message : String) -> SketchGateIssuefn sketch_hash(value : String, seed : Int) -> Intfn sketch_recommendation(severity : String, code : String, title : String, detail : String, action : String) -> SketchRecommendationfn stream_drift(baseline_name : String, baseline_input : String, candidate_name : String, candidate_input : String) -> StreamDriftfn stream_drift_json(baseline_name : String, baseline_input : String, candidate_name : String, candidate_input : String) -> Stringfn stream_drift_markdown(baseline_name : String, baseline_input : String, candidate_name : String, candidate_input : String) -> Stringfn weighted_compare_markdown(baseline : WeightedStreamSummary, candidate : WeightedStreamSummary) -> Stringfn weighted_summary(events : Array[WeightedEvent], width : Int, depth : Int, k : Int) -> WeightedStreamSummaryMoonBit streaming sketch toolkit for approximate analytics, drift checks, and compact data reports.