operational_log_patterns
sqllocks_spindle.simulation.operational_log_patterns
¶
Operational logs / observability patterns — trace/span IDs, latency spikes, outage storms.
Generate realistic application log and observability event streams with distributed tracing, latency distributions, error bursts, and outage simulation.
Usage::
from sqllocks_spindle.simulation.operational_log_patterns import (
OperationalLogSimulator, OperationalLogConfig,
)
cfg = OperationalLogConfig(service_count=5, duration_hours=24)
result = OperationalLogSimulator(config=cfg).run()
Classes¶
OperationalLogConfig
dataclass
¶
Configuration for operational log simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_count
|
int
|
Number of services (uses first N from default list). |
5
|
services
|
list[dict[str, Any]]
|
Override service definitions. |
list()
|
duration_hours
|
float
|
Time span of the simulation. |
24.0
|
start_time
|
str
|
Simulation start (ISO format). |
'2024-01-01T00:00:00'
|
events_per_hour
|
float
|
Base event rate per service per hour. |
100.0
|
latency_mean_ms
|
float
|
Mean request latency (log-normal distribution). |
50.0
|
latency_std_ms
|
float
|
Std dev for log-normal latency. |
30.0
|
latency_spike_enabled
|
bool
|
Inject latency spikes. |
True
|
latency_spike_probability
|
float
|
Per-hour chance of a latency spike. |
0.05
|
latency_spike_multiplier
|
float
|
Multiplier for latency during spikes. |
10.0
|
latency_spike_duration_minutes
|
float
|
Duration of spike window. |
15.0
|
outage_enabled
|
bool
|
Inject outage storms. |
True
|
outage_probability
|
float
|
Per-hour chance of an outage starting. |
0.02
|
outage_duration_minutes
|
float
|
How long the outage lasts. |
30.0
|
outage_error_rate
|
float
|
Fraction of requests that fail during outage. |
0.8
|
trace_enabled
|
bool
|
Generate distributed trace/span IDs. |
True
|
trace_depth_mean
|
float
|
Mean number of spans per trace. |
3.5
|
error_burst_enabled
|
bool
|
Inject error bursts. |
True
|
error_burst_probability
|
float
|
Per-hour chance of error burst. |
0.03
|
error_burst_count
|
int
|
Errors per burst. |
50
|
seed
|
int
|
Random seed. |
42
|
OperationalLogResult
dataclass
¶
Result of an operational log simulation.
Attributes:
| Name | Type | Description |
|---|---|---|
logs |
DataFrame
|
All log events sorted by timestamp. |
traces |
DataFrame
|
Distributed trace records (trace_id, spans). |
service_health |
DataFrame
|
Per-service health summary. |
stats |
dict[str, Any]
|
Aggregate statistics. |