stormlog.telemetry_model

Backend-neutral projection over the persisted telemetry event schema.

Functions

project_telemetry_mapping(record, *[, ...])

Project a normalized telemetry mapping into the projected envelope.

projected_record_to_dict(record)

Serialize a projected telemetry record to a deterministic dictionary.

unique_projected_correlations(records)

Return stable unique correlation dictionaries for projected telemetry records.

unique_projected_resources(records)

Return stable unique resource dictionaries for projected telemetry records.

Classes

ProjectedTelemetryRecord(schema_version, ...)

Small immutable event envelope shared by live and loaded telemetry.

class stormlog.telemetry_model.ProjectedTelemetryRecord(schema_version, record_id, timestamp_ns, observed_timestamp_ns, session_id, source_kind, event_type, stage, severity, severity_text, body, resource=<factory>, attributes=<factory>, correlation=<factory>)[source]

Bases: object

Small immutable event envelope shared by live and loaded telemetry.

Parameters:
  • schema_version (Literal[1])

  • record_id (str)

  • timestamp_ns (int)

  • observed_timestamp_ns (int)

  • session_id (str)

  • source_kind (str)

  • event_type (str)

  • stage (str | None)

  • severity (str | None)

  • severity_text (str | None)

  • body (str | None)

  • resource (Mapping[str, Any])

  • attributes (Mapping[str, Any])

  • correlation (Mapping[str, Any])

schema_version: Literal[1]
record_id: str
timestamp_ns: int
observed_timestamp_ns: int
session_id: str
source_kind: str
event_type: str
stage: str | None
severity: str | None
severity_text: str | None
body: str | None
resource: Mapping[str, Any]
attributes: Mapping[str, Any]
correlation: Mapping[str, Any]
stormlog.telemetry_model.project_telemetry_mapping(record, *, observed_timestamp_ns=None)[source]

Project a normalized telemetry mapping into the projected envelope.

Parameters:
  • record (Mapping[str, Any]) – Existing normalized telemetry record, normally a TelemetryEvent v3 dictionary.

  • observed_timestamp_ns (int | None) – Optional observation timestamp. Defaults to the source timestamp when no separate observation time is available.

Returns:

Backend-neutral projected telemetry record.

Raises:

ValueError – If required identity or timestamp fields are missing.

Return type:

ProjectedTelemetryRecord

stormlog.telemetry_model.projected_record_to_dict(record)[source]

Serialize a projected telemetry record to a deterministic dictionary.

Parameters:

record (ProjectedTelemetryRecord)

Return type:

dict[str, Any]

stormlog.telemetry_model.unique_projected_correlations(records)[source]

Return stable unique correlation dictionaries for projected telemetry records.

Parameters:

records (Iterable[ProjectedTelemetryRecord])

Return type:

list[dict[str, Any]]

stormlog.telemetry_model.unique_projected_resources(records)[source]

Return stable unique resource dictionaries for projected telemetry records.

Parameters:

records (Iterable[ProjectedTelemetryRecord])

Return type:

list[dict[str, Any]]