telemere/resources/signal-docstrings/signal-flow.txt

50 lines
1.9 KiB
Text
Raw Normal View History

A signal will be provided to a handler iff ALL of the following are true:
2024-04-25 07:37:55 +00:00
2024-04-12 12:57:24 +00:00
1. Signal (creation) is allowed by compile-time filters
2. Signal (creation) is allowed by runtime filters
3. Signal (handling) is allowed by handler filters
2024-04-12 12:57:24 +00:00
4. Signal middleware does not suppress the signal (return nil)
5. Handler middleware does not suppress the signal (return nil)
2024-04-12 12:57:24 +00:00
For 1-3, filtering may depend on (in order):
2024-04-25 07:37:55 +00:00
2024-04-12 12:57:24 +00:00
Sample rate → namespace → kind → id → level → when form/fn → rate limit
2024-04-25 07:37:55 +00:00
Compile-time vs runtime filtering:
Compile-time filtering is an advanced feature that can be tricky to set
and use correctly. Most folks will want ONLY runtime filtering.
Compile-time filtering works by eliding (completely removing the code for)
disallowed signals. This means zero performance cost for these signals,
but also means that compile-time filtering is PERMANENT once applied.
So if you set `:info` as the compile-time minimum level, that'll REMOVE
CODE for every signal call below `:info` level. To decrease that minimum
level, you'll need to rebuild.
Compile-time filtering can be set ONLY with environmental config
(JVM properties, environment variables, or classpath resources).
Signal and handler sampling is multiplicative:
Both signals and handlers can have independent sample rates, and these
MULTIPLY!
2024-04-12 12:57:24 +00:00
If a signal is created with 20% sampling and a handler handles 50%
2024-04-25 07:37:55 +00:00
of received signals, then 10% of possible signals will be handled
(50% of 20%).
2024-04-12 12:57:24 +00:00
2024-04-25 07:37:55 +00:00
The multiplicative rate is helpfully reflected in each signal's final
2024-04-12 12:57:24 +00:00
`:sample-rate` value.
2024-04-12 12:57:24 +00:00
For more info:
2024-04-25 07:37:55 +00:00
- Signal visual flowchart, Ref. <https://www.taoensso.com/telemere/flow>
2024-04-15 07:57:40 +00:00
- On signal filters, see: `help:signal-filters` docstring
- On handler filters, see: `help:signal-handlers` docstring
If anything is unclear, please ping me (@ptaoussanis) so that I can
improve these docs!