DiagnosticEventHandler class abstract interface

Base interface for DiagnosticEvent handlers.

Implementing diagnostic event handlers

DiagnosticEventHandler implementations are typically provided by the developer to the Serverpod constructor upon startup.

Implementations can handle DiagnosticEvent instances of a specific type or context, or all events.

Guidelines

A DiagnosticEvent represents an event that occurs in the server. DiagnosticEventHandler implementations can react to these events in order to gain insights into the behavior of the server.

As the name suggests the handlers should perform diagnostics only, and not have any responsibilities that the regular functioning of the server depends on.

The registered handlers are typically run concurrently, can not depend on each other, and asynchronously - they are not awaited by the operation they are triggered from.

If a handler throws an exception it will be logged to stderr and otherwise ignored.

Time limits

Handlers should not run for an extended period of time. Permitting that would risk accumulating resource consumption and make the long-running performance of the server degrade. This is especially true in situations of high load or implementation issues causing a large number of events.

By default they are given a maximum of 30 seconds to complete. This can be overridden by setting the diagnostic handler timeout in the constructor of the Serverpod instance.

Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

handleEvent(DiagnosticEvent event, {required OriginSpace space, required DiagnosticEventContext context}) → void
Handles an event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited