monitor.events

MonitorEvent — a timestamped, annotated marker for the dashboard timeline.

Events appear as vertical lines on all metric charts. They can be created by:
  • The dashboard UI (user types a label and clicks “Mark Event”)

  • Test suite code via OttoSuite.addMonitorEvent()

  • Automatically by OttoSuite.setUp() / tearDown() when monitoring is active

class otto.monitor.events.MonitorEvent(timestamp, label, source='manual', color='#888888', dash='dash', id=0, end_timestamp=None)

Bases: object

A labeled, timestamped marker for the monitoring dashboard.

timestamp : --is-rst--:py:class:`~datetime.datetime`

When the event occurred.

label : --is-rst--:py:class:`str`

Human-readable description shown on hover in the dashboard.

source : --is-rst--:py:class:`str` = 'manual'

‘manual’ (dashboard UI), ‘user_code’ (test code), or ‘auto’ (lifecycle).

Type:

Origin of the event

color : --is-rst--:py:class:`str` = '#888888'

CSS color for the vertical marker line (hex, named color, or rgb()).

dash : --is-rst--:py:class:`str` = 'dash'

solid, dot, dash, longdash, dashdot, longdashdot.

Type:

Plotly line dash style. One of

id : --is-rst--:py:class:`int` = 0

Unique integer id assigned by MetricCollector on creation (or loaded from SQLite).

end_timestamp : --is-rst--:py:class:`~datetime.datetime` | :py:obj:`None` = None

when the span ended. None for instantaneous events.

Type:

For span events

to_dict()

Serialize to a JSON-safe dict for the dashboard API.

Return type:

dict[str, object]