EventPublisher#
- class safir.metrics.EventPublisher[P: EventPayload](application, event_class)#
Bases:
Generic[P]Interface for event publishers.
Represents a generic publisher of application metrics events.
- Parameters:
Methods Summary
construct_event(payload)Construct the full event as it will be published.
publish(payload)Publish an event payload.
Methods Documentation
- construct_event(payload)#
Construct the full event as it will be published.
- Parameters:
pyaload – Payload to publish.
payload (
P)
- Returns:
Enriched event model including generic metadata and Avro schema configuration.
- Return type:
P
- abstractmethod async publish(payload)#
Publish an event payload.
- Parameters:
payload (
P) – Payload to publish.- Returns:
Full, enriched-with-metadata event model that was published. This will be an object of a class derived from both the type of the payload and
EventMetadata, but it is typed as the latter since that is the newly-added information that may be of interest to the caller and therefore the most likely to be accessed.- Return type: