stormlog.phases.policy

Phase attribution policy and formatting helpers.

Functions

attribute_active_spans(spans, *[, strategy, ...])

Collapse active spans into a unique or ambiguity-preserving attribution.

format_phase_path(path)

Return a human-readable phase path label.

merge_phase_attributions(first, second)

Merge two attribution candidates without inventing a false unique path.

phase_attribution_to_payload(attribution)

Serialize a phase attribution without emitting redundant summary fields.

resolve_phase_for_event(index, event)

Resolve a phase attribution for one event-like object using replay data.

summarize_phase_attribution(attribution)

Return a user-facing summary string for one phase attribution.

summarize_phase_resolution(*, phase_resolution)

Render one phase resolution without hiding ambiguity semantics.

Classes

PhaseAttribution(phase_resolution[, ...])

Resolved workload phase attribution for an anomaly or report item.

PhaseSummary(phase_path, source)

Optional presentation-oriented phase winner when canonical attribution stays ambiguous.

class stormlog.phases.policy.PhaseAttribution(phase_resolution, phase_source=None, phase_path=None, phase_paths=<factory>, scope_id=None, thread_id=None, thread_name=None, phase_summary=None)[source]

Bases: object

Resolved workload phase attribution for an anomaly or report item.

Parameters:
  • phase_resolution (str)

  • phase_source (str | None)

  • phase_path (str | None)

  • phase_paths (list[str])

  • scope_id (str | None)

  • thread_id (int | None)

  • thread_name (str | None)

  • phase_summary (PhaseSummary | None)

phase_resolution: str
phase_source: str | None = None
phase_path: str | None = None
phase_paths: list[str]
scope_id: str | None = None
thread_id: int | None = None
thread_name: str | None = None
phase_summary: PhaseSummary | None = None
class stormlog.phases.policy.PhaseSummary(phase_path, source)[source]

Bases: object

Optional presentation-oriented phase winner when canonical attribution stays ambiguous.

Parameters:
  • phase_path (str)

  • source (str)

phase_path: str
source: str
stormlog.phases.policy.attribute_active_spans(spans, *, strategy='deepest_per_thread', origin_thread_id=None, origin_phase_scope_id=None)[source]

Collapse active spans into a unique or ambiguity-preserving attribution.

Parameters:
  • spans (Sequence['PhaseSpan'])

  • strategy (str)

  • origin_thread_id (int | None)

  • origin_phase_scope_id (str | None)

Return type:

PhaseAttribution | None

stormlog.phases.policy.format_phase_path(path)[source]

Return a human-readable phase path label.

Parameters:

path (Sequence[str])

Return type:

str

stormlog.phases.policy.merge_phase_attributions(first, second)[source]

Merge two attribution candidates without inventing a false unique path.

Parameters:
Return type:

PhaseAttribution | None

stormlog.phases.policy.phase_attribution_to_payload(attribution)[source]

Serialize a phase attribution without emitting redundant summary fields.

Parameters:

attribution (PhaseAttribution | None)

Return type:

dict[str, Any] | None

stormlog.phases.policy.resolve_phase_for_event(index, event)[source]

Resolve a phase attribution for one event-like object using replay data.

Parameters:
  • index (ReplayPhaseReplayIndex)

  • event (Any)

Return type:

PhaseAttribution | None

stormlog.phases.policy.summarize_phase_attribution(attribution)[source]

Return a user-facing summary string for one phase attribution.

Parameters:

attribution (PhaseAttribution | None)

Return type:

str | None

stormlog.phases.policy.summarize_phase_resolution(*, phase_resolution, phase_path=None, phase_paths=None)[source]

Render one phase resolution without hiding ambiguity semantics.

Parameters:
  • phase_resolution (str | None)

  • phase_path (str | None)

  • phase_paths (Sequence[str] | None)

Return type:

str | None