Bellwether.Filter (bellwether v0.1.0)

Copy Markdown

Faults the Adapter is told not to report.

Deliberately separate from Bellwether.Dedupe. Dedupe answers "have I already said this?"; the blocklist answers "was I asked never to say this?" — a known, understood fault that is not worth paying for on a metered link. Collapsing them would mean an operator silencing something could not tell whether it had stopped happening.

The pattern syntax matches the Agent's, so an operator learns it once:

  • "a3f9c1d2e4b6" — exactly that fingerprint
  • "otp:MyApp.Noisy*" — anything starting with that

Not regular expressions. Someone writing a blocklist while a fleet is shouting should not be able to write one that never terminates.

Nothing is dropped silently: suppressed/1 carries the tally so a blocked fault can be reported as a count instead of vanishing.

Summary

Functions

Whether fingerprint may be reported.

Take the tally and reset it, so it can ride along with the next report.

Options: :block — a list of patterns.

What has been blocked since the last drain, and how often.

Types

t()

@type t() :: %Bellwether.Filter{patterns: term(), suppressed: term()}

Functions

blocked?(filter, fingerprint)

@spec blocked?(t(), String.t()) :: boolean()

check(filter, fingerprint)

@spec check(t(), String.t()) :: {:allow | :block, t()}

Whether fingerprint may be reported.

Returns {:allow, filter} or {:block, filter}; the filter carries the running tally either way.

drain(filter)

Take the tally and reset it, so it can ride along with the next report.

new(opts \\ [])

Options: :block — a list of patterns.

suppressed(filter)

What has been blocked since the last drain, and how often.