Skip to content

Alarms

Classes

Alarms

Alarms(*args, **kwargs)

OptionsGroup

Alarms.

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


name

.name: str = ''

Name to represent the group.


plugin

.plugin: bool | str = False

Indication this option group belongs to a plugin.


alarm_on_fd_ready

1
2
3
4
5
6
.alarm_on_fd_ready(
    alarm: TypeAlarmExt,  # (1)!
    fd: str,  # (2)!
    message: str,  # (3)!
    byte_count: int | None = None,  # (4)!
)
  1. Alarm.

  2. File descriptor.

  3. Message to send.

  4. Files to read. Default: 1 byte.

    1
    .. note:: For ``eventfd`` set 8.
    

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.


alarm_on_log

1
2
3
4
5
.alarm_on_log(
    alarm: TypeAlarmExt,  # (1)!
    matcher: str,  # (2)!
    skip: bool = False
)
  1. Alarm.

  2. Regular expression to match log line.

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


alarm_on_queue_full

1
2
3
.alarm_on_queue_full(
    alarm: TypeAlarmExt,  # (1)!
)
  1. Alarm.

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


alarm_on_segfault

1
2
3
.alarm_on_segfault(
    alarm: TypeAlarmExt,  # (1)!
)
  1. Alarm.

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

Sends a backtrace.


.print_alarms()

Print out enabled alarms.


register_alarm

1
2
3
.register_alarm(
    alarm: TypeAlarmExt,  # (1)!
)
  1. Alarm.

Register (create) an alarm.


set_basic_params

1
2
3
4
5
.set_basic_params(
    msg_size: int | None = None,  # (1)!
    cheap: bool | None = None,  # (2)!
    anti_loop_timeout: int | None = None,  # (3)!
)
  1. Set the max size of an alarm message in bytes. Default: 8192.

  2. Use main alarm thread rather than create dedicated threads for curl-based alarms

  3. Tune the anti-loop alarm system. Default: 3 seconds.


alarm_types

.alarm_types()

Alarm types available for .register_alarm().