stormlog.oom_flight_recorder

OOM flight recorder helpers for bounded event capture and dump artifacts.

Functions

classify_oom_exception(exc)

Classify whether an exception corresponds to an OOM condition.

Classes

OOMExceptionClassification(is_oom, reason)

Normalized classification result for an exception.

OOMFlightRecorder(config)

Bounded recorder that writes dump bundles on OOM.

OOMFlightRecorderConfig([enabled, dump_dir, ...])

Runtime configuration for OOM flight recorder dumps.

class stormlog.oom_flight_recorder.OOMFlightRecorder(config)[source]

Bases: object

Bounded recorder that writes dump bundles on OOM.

Parameters:

config (OOMFlightRecorderConfig)

record_event(event)[source]

Append one event payload to the in-memory ring buffer.

Parameters:

event (dict[str, Any])

Return type:

None

snapshot_events()[source]

Return buffered events in chronological order.

Return type:

list[dict[str, Any]]

clear()[source]

Discard buffered events for the next session/run.

Return type:

None

dump(*, reason, exception, context, backend, metadata=None, session_summary=None)[source]

Write an OOM diagnostic bundle and enforce retention constraints.

Parameters:
  • reason (str)

  • exception (BaseException)

  • context (str | None)

  • backend (str)

  • metadata (dict[str, Any] | None)

  • session_summary (SessionSummary | None)

Return type:

str | None

class stormlog.oom_flight_recorder.OOMFlightRecorderConfig(enabled=False, dump_dir='oom_dumps', buffer_size=10000, max_dumps=5, max_total_mb=256)[source]

Bases: object

Runtime configuration for OOM flight recorder dumps.

Parameters:
  • enabled (bool)

  • dump_dir (str)

  • buffer_size (int)

  • max_dumps (int)

  • max_total_mb (int)

enabled: bool = False
dump_dir: str = 'oom_dumps'
buffer_size: int = 10000
max_dumps: int = 5
max_total_mb: int = 256
class stormlog.oom_flight_recorder.OOMExceptionClassification(is_oom, reason)[source]

Bases: object

Normalized classification result for an exception.

Parameters:
  • is_oom (bool)

  • reason (str | None)

is_oom: bool
reason: str | None
stormlog.oom_flight_recorder.classify_oom_exception(exc)[source]

Classify whether an exception corresponds to an OOM condition.

Parameters:

exc (BaseException)

Return type:

OOMExceptionClassification