Skip to content

config

sqllocks_spindle.streaming.config

Streaming configuration dataclasses for Spindle Phase 2.

Classes

BurstWindow dataclass

A time window where event rate is multiplied by a factor.

Parameters:

Name Type Description Default
start_offset_seconds float

Seconds from stream start when the burst begins.

required
duration_seconds float

How long the burst lasts.

required
multiplier float

Rate multiplier during the burst (e.g. 10.0 = 10x normal rate).

required

Example::

# 10x rate burst starting at t=30s, lasting 60 seconds
BurstWindow(start_offset_seconds=30, duration_seconds=60, multiplier=10.0)
Methods:
is_active(elapsed)

Return True if the burst window is active at the given elapsed time.

TimePattern dataclass

Time-of-day and day-of-week rate multipliers.

Applied on top of the base rate when simulating real-world temporal patterns. E.g., e-commerce has high traffic 7pm–10pm and lower traffic at 3am.

Parameters:

Name Type Description Default
hour_multipliers dict[int, float]

Mapping of hour (0–23) to multiplier.

dict()
dow_multipliers dict[int, float]

Mapping of day-of-week (0=Monday … 6=Sunday) to multiplier.

dict()
Methods:
get_multiplier(hour, dow)

Return the composite multiplier for a given hour and day-of-week.

business_hours() classmethod

Higher traffic 8am–6pm weekdays, very low on weekends.

retail_peak() classmethod

E-commerce pattern: evenings peak, weekends elevated.

StreamConfig dataclass

Configuration for a Spindle streaming run.

Parameters:

Name Type Description Default
events_per_second float

Base target throughput.

10.0
duration_seconds float | None

Stop after this many wall-clock seconds (None = no limit).

None
max_events int | None

Stop after this many events (None = no limit).

None
out_of_order_fraction float

Fraction of events to reorder (0.0–1.0).

0.0
out_of_order_max_delay_slots int

Maximum slot positions an OOO event is delayed.

10
burst_windows list[BurstWindow]

List of :class:BurstWindow definitions.

list()
time_pattern TimePattern | None

Optional :class:TimePattern for time-of-day multipliers.

None
label_anomalies bool

Keep _spindle_is_anomaly / _spindle_anomaly_type columns in emitted events (default True).

True
batch_size int

Events per :meth:StreamWriter.send_batch call.

100
realtime bool

If True, rate-limit emissions using a token bucket + Poisson inter-arrival times. If False (default), emit as fast as possible (useful for bulk loading and unit tests).

False
Methods:
get_rate_multiplier(elapsed, wall_hour=0, wall_dow=0)

Return the composite rate multiplier at a given moment.

Parameters:

Name Type Description Default
elapsed float

Seconds since stream start.

required
wall_hour int

Current wall-clock hour (0–23).

0
wall_dow int

Current wall-clock day-of-week (0=Monday).

0