FailedEventPublisher¶
- class safir.metrics.FailedEventPublisher(application, event_class, logger)¶
Bases:
EventPublisher
,Generic
Event publisher that logs error messages instead of publishing.
This is used when app metrics initialization has failed due to underlying infrastructure issues, but we don’t want to crash the instrumented app.
- Parameters:
application (
str
)event_class (
type
[TypeVar
(P
, bound=EventPayload
)])logger (
BoundLogger
)
Methods Summary
publish
(payload)Publish an event payload.
Methods Documentation
- async publish(payload)¶
Publish an event payload.
- Parameters:
payload (
TypeVar
(P
, bound=EventPayload
)) – 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: