How jangidbhai2003-commits/sentinelmesh works
Purpose and Entry Points
SentinelMesh is a Python backend library for incident intelligence. Its primary entry point is the local CLI in src/sentinelmesh/cli.py; reusable package APIs are organized beneath src/sentinelmesh/. The system converts heterogeneous observability inputs into a shared event model, then supports analysis, rule-driven incident handling, persistence, and report generation.
Ingestion and Event Contract
The ingestion boundary accepts Prometheus, Loki, synthetic-check, and PagerDuty-style payloads. src/sentinelmesh/ingestion/sources.py identifies/parses source formats, while src/sentinelmesh/ingestion/normalizer.py converts them to the common contract defined by src/sentinelmesh/ingestion/envelope.py. Schema validation and payload shape definitions reside in src/sentinelmesh/ingestion/schemas.py.
This normalized envelope is the principal boundary between external telemetry providers and all downstream domain logic.
Rule Evaluation Pipeline
Rules are expressed as policies and compiled into executable evaluation structures via src/sentinelmesh/rules/policy.py and src/sentinelmesh/rules/compiler.py. src/sentinelmesh/rules/engine.py evaluates normalized events and metric-derived values against rule conditions in src/sentinelmesh/rules/conditions.py.
The rules subsystem separates declarative policy input from runtime evaluation, allowing ingestion sources and storage implementations to remain independent of alerting logic.
Metrics and Reliability Signals
Metric processing is centered on time series, windows, aggregation, and burn-rate calculations: src/sentinelmesh/metrics/series.py, src/sentinelmesh/metrics/windows.py, and src/sentinelmesh/metrics/burn_rate.py. src/sentinelmesh/metrics/aggregations.py derives rollups consumed by rules and reporting.
This stage turns stored or incoming telemetry into bounded-window reliability signals, including SLO burn-rate indicators.
Incident Domain Lifecycle
Rule matches and related events are grouped into incidents through src/sentinelmesh/incidents/dedupe.py. Incident state transitions and escalation-oriented lifecycle behavior are handled in src/sentinelmesh/incidents/lifecycle.py; historical event/state records are represented by src/sentinelmesh/incidents/timeline.py. Severity classification is isolated in src/sentinelmesh/incidents/severity.py.
This keeps incident identity, state, severity, and history distinct from raw-event ingestion and rule definitions.
Storage and Query Boundary
Persistence is defined behind repository and query abstractions in src/sentinelmesh/storage/repository.py and src/sentinelmesh/storage/query.py. The available concrete runtime store is deterministic in-memory storage at src/sentinelmesh/storage/memory.py, with snapshot import/export support in src/sentinelmesh/storage/snapshots.py.
There is no indicated database, message broker, HTTP server, or cloud service integration; external systems currently enter through payload normalization rather than deployed connectors.
Reporting and Operational Output
Reliability summaries are assembled in src/sentinelmesh/reports/summary.py, serialized in src/sentinelmesh/reports/serialization.py, and sanitized by recursive redaction in src/sentinelmesh/reports/redaction.py. CLI workflows expose snapshots and reports through src/sentinelmesh/cli.py.
Cross-cutting deterministic primitives—clock access, identifiers, pagination, errors, and result handling—are centralized in src/sentinelmesh/core/clock.py, src/sentinelmesh/core/ids.py, and src/sentinelmesh/core/result.py.
Main entry points: engine.py Rule engine · envelope.py Normalized envelope · sources.py Source parser · repository.py Repository & query API
Components 19
Ingestion
External payloads are normalized at this boundary.
- Telemetry payloads · Prometheus, Loki, synthetic-check, and PagerDuty-style payloads.
- Source parser
src/sentinelmesh/ingestion/sources.py - Event normalizer
src/sentinelmesh/ingestion/normalizer.py - Normalized envelope · Principal boundary for downstream domain logic.
src/sentinelmesh/ingestion/envelope.py - Payload schemas
src/sentinelmesh/ingestion/schemas.py
Rules
- Rule policies
src/sentinelmesh/rules/policy.py - Policy compiler
src/sentinelmesh/rules/compiler.py - Rule engine
src/sentinelmesh/rules/engine.py - Rule conditions
src/sentinelmesh/rules/conditions.py
Metrics
- Time series & windows
src/sentinelmesh/metrics/series.py - Aggregation & burn rate · Derives rollups and SLO burn-rate indicators.
src/sentinelmesh/metrics/burn_rate.py
Incidents
- Incident deduplication
src/sentinelmesh/incidents/dedupe.py - Incident lifecycle
src/sentinelmesh/incidents/lifecycle.py - Incident timeline
src/sentinelmesh/incidents/timeline.py
Storage & Output
- Repository & query API
src/sentinelmesh/storage/repository.py - In-memory store · Deterministic runtime persistence.
src/sentinelmesh/storage/memory.py - Snapshot import/export
src/sentinelmesh/storage/snapshots.py - Reliability reports · Assembles, serializes, and redacts summaries.
src/sentinelmesh/reports/summary.py
Other components
- Local CLI · Runs ingestion, snapshot, and report workflows.
src/sentinelmesh/cli.py
Connections 23
- Local CLI → Source parser: accepts payloads
- Local CLI → Snapshot import/export: imports/exports
- Local CLI → Reliability reports: renders
- Telemetry payloads → Source parser: raw payloads
- Source parser → Payload schemas: validates
- Source parser → Event normalizer: parsed source data
- Event normalizer → Normalized envelope: common event
- Rule policies → Policy compiler: compiled into
- Policy compiler → Rule engine: evaluation structures
- Rule conditions → Rule engine: conditions
- Normalized envelope → Rule engine: events
- Normalized envelope → Time series & windows: telemetry
- Time series & windows → Aggregation & burn rate: bounded windows
- Aggregation & burn rate → Rule engine: derived values
- Rule engine → Incident deduplication: rule matches
- Incident deduplication → Incident lifecycle: incidents
- Incident lifecycle → Incident timeline: state history
- Normalized envelope → Repository & query API: stores events
- Incident lifecycle → Repository & query API: persists incidents
- Repository & query API → In-memory store: implemented by
- Snapshot import/export → In-memory store: imports/exports state
- Repository & query API → Reliability reports: queried data
- Aggregation & burn rate → Reliability reports: reliability signals