Mergeable integer latency histograms with quantile and threshold bounds
moon run cmd/main --release
moon test --release --deny-warnmoon build --target js --release --deny-warn
node _build/js/release/build/cmd/collect/collect.js --help
python scripts/check_collect.py{"version":"1","services":[{"service":"api","unit":"ms","width":"10","slots":3,"identities":256,"objectives":[{"name":"p99","threshold":"400","target":990000}]}]}moon build --target js --release --deny-warn
node _build/js/release/build/cmd/produce/produce.js --help
node _build/js/release/build/cmd/collect/collect.js fleet config.json api=api.mls
node _build/js/release/build/cmd/collect/collect.js journal --help
python scripts/check_collect.pypub(all) enum BatchCollectError {
MalformedBatch(BatchError)
BatchTooLarge
RejectedShard(Int, CollectError)
}pub(all) enum BatchError {
InvalidBatchSize
InvalidBatchHeader
InvalidBatchFrame(Int)
InvalidBatchShard(Int, ShardError)
}pub(all) enum CheckpointError {
BadCheckpointHeader
BadCheckpointConfiguration
BadCheckpointFrame(Int)
BadCheckpointShard(Int, ShardError)
BadCheckpointState(Int, CollectError)
}pub(all) enum CollectError {
WindowFailure(WindowError)
ShardFailure(ShardError)
UnitMismatch
IncompatibleTimeBucket
ConflictingIdentity
IdentityBudget
}pub struct Collector {
// private fields
}fn Collector::new(unit : LatencyUnit, width : Int64, slots : Int, identities? : Int) -> Result[Collector, CollectError]fn Collector::receive_batch(self : Collector, shards : Array[Shard]) -> Result[BatchReceipt, BatchCollectError]fn Collector::receive_batch_bytes(self : Collector, bytes : Bytes) -> Result[BatchReceipt, BatchCollectError]pub(all) enum ConfigError {
ConfigSize
ConfigSyntax
ConfigVersion
InvalidServiceConfig(Int)
ServiceRejected(Int, RegistryError)
ObjectiveRejected(Int, PolicyError)
}pub(all) enum DeltaError {
UnitChanged
SourceChanged
SequenceDidNotIncrease
TimestampWentBackward
BucketDecreased(Int)
}pub struct Deployment {
// private fields
}fn Deployment::report(self : Deployment, registry : Registry) -> Result[Array[ServiceReport], RegistryError]pub struct Distribution {
// private fields
}pub struct Histogram {
// private fields
}pub(all) enum InputError {
InputClosed
ChunkTooLarge
LineTooLong(Int64)
InvalidRow(Int64)
InvalidReading(Int64, ProducerError)
}pub(all) enum JournalError {
JournalClosed
BadJournalMagic
BadFrameLength(Int64)
BadFrameChecksum(Int64)
UnexpectedEnd(Int64)
BadJournalBatch(Int64, BatchCollectError)
OversizedChunk
}pub struct JournalReader {
// private fields
}fn JournalReader::feed(self : JournalReader, chunk : BytesView, emit : (BatchReceipt) -> Unit) -> Result[Unit, JournalError]pub struct JournalWriter {
// private fields
}pub(all) enum LatencyUnit {
Nanoseconds
Microseconds
Milliseconds
}pub struct Policy {
// private fields
}fn Policy::compare(self : Policy, previous : Distribution, current : Distribution) -> Array[ObjectiveTransition]pub(all) enum PolicyError {
EmptyPolicy
TooManyObjectives
InvalidObjective(Int)
DuplicateObjective(Int)
}pub struct Producer {
// private fields
}fn Producer::new(source : Int64, unit : LatencyUnit, width : Int64, sequence? : Int64) -> Result[Producer, ProducerError]pub(all) enum ProducerError {
InvalidProducer
InvalidSample
SampleOutOfOrder
SampleCountOverflow
SequenceExhausted
ProducerFinished
}pub(all) struct QuantileComparison {
baseline : Interval?
current : Interval?
change : LatencyChange
difference : Interval?
}pub struct Registry {
// private fields
}fn Registry::advance(self : Registry, service : String, timestamp : Int64) -> Result[Unit, RegistryError]fn Registry::evaluate(self : Registry, service : String, policy : Policy) -> Result[ServiceReport, RegistryError]fn Registry::receive_atomic(self : Registry, routes : Array[RoutedShard]) -> Result[BatchReceipt, RouteTransactionError]fn Registry::receive_batch_bytes(self : Registry, service : String, bytes : Bytes) -> Result[BatchReceipt, RegistryError]fn Registry::receive_bytes(self : Registry, service : String, bytes : Bytes) -> Result[Receipt, RegistryError]pub(all) enum RegistryCheckpointError {
RegistryHeader
RegistryFrame(Int)
RegistryName(Int)
RegistryQuota(Int)
ServiceCheckpoint(Int, CheckpointError)
}pub(all) enum RegistryError {
InvalidService
DuplicateService
UnknownService
ServiceBudget
RoutedFailure(CollectError)
RoutedBatchFailure(BatchCollectError)
}pub(all) struct ReplayStats {
frames : Int64
added : Int64
duplicates : Int64
bytes : Int64
}pub struct SampleInput {
// private fields
}fn SampleInput::feed(self : SampleInput, chunk : String, emit : (Shard) -> Unit) -> Result[Unit, InputError]pub(all) struct ServiceConfig {
service : String
unit : LatencyUnit
width : Int64
slots : Int
identities : Int
}pub(all) struct ServiceReport {
service : String
unit : LatencyUnit
objectives : Array[ObjectiveResult]
}pub struct Shard {
// private fields
}fn Shard::new(source : Int64, sequence : Int64, timestamp : Int64, unit : LatencyUnit, histogram : Histogram, width? : Int64) -> Result[Shard, ShardError]pub(all) enum SloStatus {
Met
Missed
Indeterminate
NoSamples
}pub(all) enum SnapshotError {
InvalidSize
InvalidHeader
InvalidBucketOrder
InvalidCount
}pub struct Window {
// private fields
}pub(all) enum WindowError {
InvalidConfiguration
InvalidObservation
ClockWentBackward
CountOverflow
}pub(all) enum WriterError {
WriterClosed
FrameRejected(BatchError)
InvalidWriterLimit
ShardExceedsFrameLimit
}fn compare_quantile(baseline : Distribution, current : Distribution, percentile : Int) -> QuantileComparison?fn replay_journal(collector : Collector, read : () -> Result[Bytes?, String]) -> Result[ReplayStats, ReplayError]Install
Download zipMergeable integer latency histograms with quantile and threshold bounds