Alarms

class uwsgiconf.options.alarms.Alarms(*args, **kwargs)

Alarms.

This subsystem allows the developer/sysadmin to “announce” special conditions of an app via various channels.

class alarm_types

Alarm types available for .register_alarm().

command

alias of uwsgiconf.options.alarm_types.AlarmCommand

curl

alias of uwsgiconf.options.alarm_types.AlarmCurl

log

alias of uwsgiconf.options.alarm_types.AlarmLog

mule

alias of uwsgiconf.options.alarm_types.AlarmMule

signal

alias of uwsgiconf.options.alarm_types.AlarmSignal

xmpp

alias of uwsgiconf.options.alarm_types.AlarmXmpp

set_basic_params(*, msg_size: int = None, cheap: bool = None, anti_loop_timeout: int = None)
Parameters:
  • msg_size – Set the max size of an alarm message in bytes. Default: 8192.
  • cheap – Use main alarm thread rather than create dedicated threads for curl-based alarms
  • anti_loop_timeout – Tune the anti-loop alarm system. Default: 3 seconds.
print_alarms()

Print out enabled alarms.

register_alarm(alarm: List[uwsgiconf.options.alarm_types.AlarmType])

Register (create) an alarm.

Parameters:alarm – Alarm.
alarm_on_log(alarm: List[uwsgiconf.options.alarm_types.AlarmType], matcher: str, *, skip: bool = False)

Raise (or skip) the specified alarm when a log line matches the specified regexp.

Parameters:
  • alarm – Alarm.
  • matcher – Regular expression to match log line.
  • skip
alarm_on_fd_ready(alarm: List[uwsgiconf.options.alarm_types.AlarmType], *, fd: str, message: str, byte_count: int = None)

Triggers the alarm when the specified file descriptor is ready for read.

This is really useful for integration with the Linux eventfd() facility. Pretty low-level and the basis of most of the alarm plugins.

Parameters:
  • alarm – Alarm.
  • fd – File descriptor.
  • message – Message to send.
  • byte_count

    Files to read. Default: 1 byte.

    Note

    For eventfd set 8.

alarm_on_queue_full(alarm: List[uwsgiconf.options.alarm_types.AlarmType])

Raise the specified alarm when the socket backlog queue is full.

Parameters:alarm – Alarm.
alarm_on_segfault(alarm: List[uwsgiconf.options.alarm_types.AlarmType])

Raise the specified alarm when the segmentation fault handler is executed.

Sends a backtrace.

Parameters:alarm – Alarm.