smonitor.core package#

Submodules#

smonitor.core.context module#

class smonitor.core.context.Frame(function: 'str', module: 'str', args: 'Optional[Dict[str, Any]]'=None, time: 'str' = <factory>, tags: 'Optional[List[str]]' = None, duration_ms: 'Optional[float]' = None)[source]#

Bases: object

Parameters:
  • function (str)

  • module (str)

  • args (Dict[str, Any] | None)

  • time (str)

  • tags (List[str] | None)

  • duration_ms (float | None)

args: Dict[str, Any] | None = None#
duration_ms: float | None = None#
function: str#
module: str#
tags: List[str] | None = None#
time: str#
smonitor.core.context.get_context(trace_depth=None)[source]#
Parameters:

trace_depth (int | None)

Return type:

Dict[str, Any] | None

smonitor.core.context.pop_frame()[source]#
Return type:

Frame | None

smonitor.core.context.push_frame(frame)[source]#
Parameters:

frame (Frame)

Return type:

None

smonitor.core.decorator module#

smonitor.core.decorator.random() x in the interval [0, 1).#
smonitor.core.decorator.signal(func=None, *, tags=None, exception_level='ERROR')[source]#
Parameters:
  • func (Callable[[...], Any] | None)

  • tags (list[str] | None)

  • exception_level (str)

smonitor.core.manager module#

class smonitor.core.manager.Manager[source]#

Bases: object

add_handler(handler)[source]#
Parameters:

handler (Any)

Return type:

None

property config: ManagerConfig#
configure(*, level=None, theme=None, capture_warnings=None, capture_logging=None, capture_exceptions=None, trace_depth=None, show_traceback=None, profile=None, handlers=None, routes=None, filters=None, args_summary=None, profiling=None, codes=None, signals=None, strict_signals=None, strict_schema=None, enabled=None, profiling_buffer_size=None, profiling_hooks=None, profiling_sample_rate=None, event_buffer_size=None, config_path=None, silence=None, handler_error_threshold=None)[source]#
Parameters:
  • level (str | None)

  • theme (str | None)

  • capture_warnings (bool | None)

  • capture_logging (bool | None)

  • capture_exceptions (bool | None)

  • trace_depth (int | None)

  • show_traceback (bool | None)

  • profile (str | None)

  • handlers (Iterable[Any] | None)

  • routes (List[Dict[str, Any]] | None)

  • filters (List[Dict[str, Any]] | None)

  • args_summary (bool | None)

  • profiling (bool | None)

  • codes (Dict[str, Dict[str, Any]] | None)

  • signals (Dict[str, Dict[str, Any]] | None)

  • strict_signals (bool | None)

  • strict_schema (bool | None)

  • enabled (bool | None)

  • profiling_buffer_size (int | None)

  • profiling_hooks (List[Any] | None)

  • profiling_sample_rate (float | None)

  • event_buffer_size (int | None)

  • config_path (str | Path | None)

  • silence (List[str] | None)

  • handler_error_threshold (int | None)

Return type:

None

emit(level, message, *, source=None, extra=None, category=None, code=None, tags=None, exception_type=None)[source]#
Parameters:
  • level (str)

  • message (str)

  • source (str | None)

  • extra (Dict[str, Any] | None)

  • category (str | None)

  • code (str | None)

  • tags (List[str] | None)

  • exception_type (str | None)

Return type:

Dict[str, Any]

get_codes()[source]#
Return type:

Dict[str, Dict[str, Any]]

get_signals()[source]#
Return type:

Dict[str, Dict[str, Any]]

recent_events(limit=None)[source]#
Parameters:

limit (int | None)

Return type:

List[Dict[str, Any]]

record_call()[source]#
Return type:

None

record_timing(key, duration_ms, *, span=False, meta=None)[source]#
Parameters:
  • key (str)

  • duration_ms (float)

  • span (bool)

  • meta (Dict[str, Any] | None)

Return type:

None

remove_handler(handler)[source]#
Parameters:

handler (Any)

Return type:

None

report()[source]#
Return type:

Dict[str, Any]

resolve(message=None, *, code=None, extra=None)[source]#

Resolves a message and hint from code/template without emitting an event.

Parameters:
  • message (str | None)

  • code (str | None)

  • extra (Dict[str, Any] | None)

Return type:

tuple[str, str | None]

class smonitor.core.manager.ManagerConfig(level: 'str' = 'WARNING', theme: 'str' = 'plain', capture_warnings: 'bool' = True, capture_logging: 'bool' = True, trace_depth: 'int' = 3, show_traceback: 'bool' = False, profile: 'str' = 'user', capture_exceptions: 'bool' = False, args_summary: 'bool' = False, profiling: 'bool' = False, strict_signals: 'bool' = False, strict_schema: 'bool' = False, enabled: 'bool' = True, profiling_buffer_size: 'int' = 1000, profiling_hooks: 'list | None' = None, profiling_sample_rate: 'float' = 1.0, event_buffer_size: 'int' = 0, silence: 'list[str]' = <factory>, handler_error_threshold: 'int' = 0)[source]#

Bases: object

Parameters:
  • level (str)

  • theme (str)

  • capture_warnings (bool)

  • capture_logging (bool)

  • trace_depth (int)

  • show_traceback (bool)

  • profile (str)

  • capture_exceptions (bool)

  • args_summary (bool)

  • profiling (bool)

  • strict_signals (bool)

  • strict_schema (bool)

  • enabled (bool)

  • profiling_buffer_size (int)

  • profiling_hooks (list | None)

  • profiling_sample_rate (float)

  • event_buffer_size (int)

  • silence (list[str])

  • handler_error_threshold (int)

args_summary: bool = False#
capture_exceptions: bool = False#
capture_logging: bool = True#
capture_warnings: bool = True#
enabled: bool = True#
event_buffer_size: int = 0#
handler_error_threshold: int = 0#
level: str = 'WARNING'#
profile: str = 'user'#
profiling: bool = False#
profiling_buffer_size: int = 1000#
profiling_hooks: list | None = None#
profiling_sample_rate: float = 1.0#
show_traceback: bool = False#
silence: list[str]#
strict_schema: bool = False#
strict_signals: bool = False#
theme: str = 'plain'#
trace_depth: int = 3#
smonitor.core.manager.get_manager()[source]#
Return type:

Manager

Module contents#