Flow PHP

AttributeFilter

Read onlyYes
FinalYes

Decides whether a telemetry signal should be dropped based on its attributes.

Evaluates a single root Matcher (compose them with All, Any and Not) against one or more AttributeSources. The matcher is run independently against each configured source and the results are OR-combined: a signal "matches" when the matcher matches in ANY of the sources. The polarity ($exclude) is then applied once to that combined result - when the matcher matches, the signal is dropped (exclude, the default) or kept (when exclude is false, i.e. keep ONLY matching signals).

The whole decision is baked into a single cached closure on construction: the raw matcher is compiled once (see CompiledMatcher) and wrapped with the per-source OR and the polarity. Processors fetch it via self::dropFunction() and invoke it directly with one Attributes per source, avoiding a method-call layer on the hot path.

Methods

__construct()  : mixed
dropFunction()  : callable(Attributes...): bool
The compiled drop decision: true when a signal carrying the given per-source attributes should be dropped. Pass one {@see Attributes} per configured source (see {@see self::sources()}); the matcher is OR-combined across them. Processors hold this closure and call it directly to skip the {@see self::shouldDrop()} method-call layer on the hot path.
shouldDrop()  : bool
True when a signal carrying these per-source attributes should be dropped.
sources()  : array<int, AttributeSource>

Methods

__construct()

public __construct(Matcher $matcher[, bool $exclude = true ][, array<int, AttributeSource$sources = [AttributeSource::SIGNAL] ][, null|string $cacheDir = null ][, int $cacheDirPermissions = 0700 ]) : mixed
Parameters
$matcher : Matcher
$exclude : bool = true

when true (default) a match drops the signal; when false only matching signals are kept

$sources : array<int, AttributeSource> = [AttributeSource::SIGNAL]

attribute sets to inspect; the matcher is OR-combined across them (defaults to the signal's own attributes)

$cacheDir : null|string = null

directory for the generated matcher file (defaults to the system temp directory). It is required, so it MUST be trusted - not writable by untrusted users. Prefer an application-private directory over the shared system temp in multi-tenant environments.

$cacheDirPermissions : int = 0700

mode applied when the cache directory is created (octal, subject to umask; defaults to 0700 - owner only, since the directory holds required PHP)

dropFunction()

The compiled drop decision: true when a signal carrying the given per-source attributes should be dropped. Pass one {@see Attributes} per configured source (see {@see self::sources()}); the matcher is OR-combined across them. Processors hold this closure and call it directly to skip the {@see self::shouldDrop()} method-call layer on the hot path.

public dropFunction() : callable(Attributes...): bool
Return values
callable(Attributes...): bool

shouldDrop()

True when a signal carrying these per-source attributes should be dropped.

public shouldDrop(Attributes ...$perSource) : bool

Pass one Attributes per configured source (see self::sources()).

Parameters
$perSource : Attributes
Return values
bool
On this page

Search results