Skip to content

Track events filtered out by MQL/subscription queries in mantis-publish-core - #865

Draft
james-lubin wants to merge 2 commits into
masterfrom
track-mql-filtered-events-client
Draft

Track events filtered out by MQL/subscription queries in mantis-publish-core#865
james-lubin wants to merge 2 commits into
masterfrom
track-mql-filtered-events-client

Conversation

@james-lubin

@james-lubin james-lubin commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What & why

Adds a mantisEventsFiltered Spectator counter to mantis-publish-core, tracking events that were evaluated against a subscription's query but did not match (and were therefore not published). This is the client-publish-side ("MRE") counterpart to a Netflix-internal fix that added an equivalent mqlEventsFilteredOut counter on the Mantis source-job side.

Without this, operators had no way to distinguish "the query genuinely has low match volume" from "events are being silently filtered out" on the publish-client side — mantisEventsDropped/mantisEventsSkipped don't cover this case, since the event is neither dropped from the queue nor skipped due to no active subscriptions; it's evaluated and simply doesn't match.

What changed

  • StreamMetrics#getMantisEventsFilteredCounter(String subscriptionId): a new counter tagged stream + a cardinality-limited subscriptionId (CardinalityLimiters.mostFrequent(50)), with counters cached per limited id. Access to the limiter is synchronized since CardinalityLimiters.mostFrequent is backed by a non-thread-safe LinkedHashMap and StreamMetrics is shared across concurrently-processed events.
  • EventProcessor#process(...): increments the new counter for each subscription whose matches(event) returns false. The matching branch and the exception-catch branch (which still only increments mantisQueryFailed) are unchanged.
  • Purely additive — no existing metric names, tags, or method signatures change.

Test plan

  • ./gradlew :mantis-publish:mantis-publish-core:build passes (compile, tests, license checks)
  • New/extended unit tests cover: counter registration and tags, per-id caching, distinct counters per subscription id, cardinality-limit overflow collapsing into the --others-- bucket, and the EventProcessor non-match/match/throws branches

Client-publish-side (MRE) counterpart to the mqlEventsFilteredOut counter
added on the Mantis source-job side (Netflix-internal PR #949). Tagged by
stream and a cardinality-limited subscriptionId (CardinalityLimiters.mostFrequent(50),
matching the limit used by MqlEvalStage), with one Counter cached per
limited id. Access to the limiter is synchronized since it is backed by
a non-thread-safe LinkedHashMap and StreamMetrics is shared across
concurrently-processed events.
EventProcessor.process now increments StreamMetrics#getMantisEventsFilteredCounter
for each subscription whose Subscription.matches(event) returns false.
Matching subscriptions and the matches()-throws path (which still only
increments mantisQueryFailed) are unaffected.
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Test Results

165 files  +1  165 suites  +1   10m 17s ⏱️ - 1m 22s
806 tests +9  795 ✅ +10  11 💤 ±0  0 ❌  - 1 
806 runs  +8  795 ✅ + 9  11 💤 ±0  0 ❌  - 1 

Results for commit 6b61987. ± Comparison against base commit bc70c0a.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant