Class: Cybertrain::ErrorReporter::Filter
- Inherits:
-
Object
- Object
- Cybertrain::ErrorReporter::Filter
- Defined in:
- cybertrain/error_reporter.rb
Overview
The base of an error filter: override #filter_event. Filters run on the reporter’s delivery thread, in the order they were added (#add_filter), before every subscriber and the sender. Each takes the event and answers true to keep it or false to drop it; it may change the event’s message (Cybertrain::ErrorEvent#error_message=) and its context (Cybertrain::ErrorEvent#set_error_context, Cybertrain::ErrorEvent#delete_error_context) on the way, and the next filter, the subscribers and the sender see the change. Once one drops it, the later ones do not run, and nothing receives the event; it is not counted among the queue’s drops.
Filters run after the dedupe: it was decided when the report was
made, on the unfiltered class, message and where. A filter that
rewrites the message does not change which reports collapse, and an
event a filter drops still holds its dedupe slot for
DEDUPE_SECONDS seconds (a like report in that time
is not queued, so no filter sees it).
A filter that raises drops the event (fail closed: a filter exists
to keep something from leaving); the failure is logged at error,
error filter failed: <Filter class>: <Class>: <message>, and is
never reported.
What a filter does not reach: the framework’s own ERROR log line of
the failure (job 3 (MailJob) failed: ..., the 500’s line) is
written by the caller before the event exists, unfiltered; so is
anything the application logs itself.
Instance Method Summary collapse
-
#filter_event(event) ⇒ Boolean
Keeps or drops one event; the base keeps every event.
Instance Method Details
#filter_event(event) ⇒ Boolean
Keeps or drops one event; the base keeps every event.
322 323 324 |
# File 'cybertrain/error_reporter.rb', line 322 def filter_event(event) true end |