praval.observability.export.console_viewer

Console trace viewer for debugging and local development.

Displays traces in a tree format showing: - Span hierarchy (parent-child relationships) - Timing information - Errors and events

Functions

print_traces([trace_ids, limit, ...])

Print traces from local storage to console.

show_recent_traces([limit, use_colors])

Show the most recent traces (convenience function).

Classes

ConsoleViewer([use_colors])

Console viewer for displaying traces in terminal.

class praval.observability.export.console_viewer.ConsoleViewer(use_colors=True)[source]

Bases: object

Console viewer for displaying traces in terminal.

Parameters:

use_colors (bool)

__init__(use_colors=True)[source]

Initialize console viewer.

Parameters:

use_colors (bool) – Whether to use ANSI colors in output

display_trace(trace_id, spans)[source]

Display a single trace in tree format.

Parameters:
  • trace_id (str) – Trace ID

  • spans (List[Dict[str, Any]]) – List of spans in the trace

Return type:

None

display_traces(spans)[source]

Display multiple traces grouped by trace_id.

Parameters:

spans (List[Dict[str, Any]]) – List of spans from potentially multiple traces

Return type:

None

display_summary(spans)[source]

Display summary statistics for traces.

Parameters:

spans (List[Dict[str, Any]]) – List of spans

Return type:

None

praval.observability.export.console_viewer.print_traces(trace_ids=None, limit=10, summary_only=False, use_colors=True)[source]

Print traces from local storage to console.

Parameters:
  • trace_ids (Optional[List[str]]) – Optional list of specific trace IDs to display (None = recent)

  • limit (int) – Maximum number of traces to display (default: 10)

  • summary_only (bool) – If True, only show summary statistics

  • use_colors (bool) – Whether to use ANSI colors in output

Return type:

None

Example

# Show last 10 traces print_traces()

# Show specific trace print_traces(trace_ids=[“abc123…”])

# Show summary only print_traces(summary_only=True)

praval.observability.export.console_viewer.show_recent_traces(limit=5, use_colors=True)[source]

Show the most recent traces (convenience function).

Parameters:
  • limit (int) – Number of recent traces to show

  • use_colors (bool) – Whether to use ANSI colors

Return type:

None