Page MenuHomePhabricator

[EventGate] Sanitize stream name in all metrics
Closed, ResolvedPublic

Description

Background

While investigating the ongoing test-kitchen/standalone-event-system-success-rate SLO budget burn, I noticed that the eventgate_validation_errors_total metric has the stream_name label. Running a Prometheus query like:

sum by(stream) (rate(eventgate_validation_errors_total{service="eventgate-analytics-external", error_type="HoistingError"}[5m])) * 60

Screenshot 2026-06-22 at 15.08.40.png (2,150×826 px, 202 KB)

AC

  • If the stream name isn't known, then use "unknown" as the stream name

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Run ensureEventAllowedInStream before applyTransformsrepos/data-engineering/eventgate-wikimedia!36tchinT429799master
Customize query in GitLab

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Hm! So this is just some client sent junk/spam? Interesting!

Right, and applyTransforms (which includes hoisting logic) is happening before ensureEventAllowedInStream.

And, we have to do that, because the setWikimediaDefaults Transform allows for setting meta.stream via a query param.

@tchin, I recall that we decided not to break apart makeSetWikimediaDefaults into different transform functions for simplicity, and because some of the logic in there had ordering dependencies. I wonder, could we perhaps extract the logic to set meta.stream and $schema out of a 'transform function' and just make it a 'hardcoded' feature in makeWikimediaValidate? Then there we could do things in this order:

  • maybe set $schema from query param
  • maybe set meta.stream from query param
  • ensureEventAllowedInStream
  • applyTransforms
  • validate
phuedx renamed this task from Sanitize stream name in all EventGate metrics to [EventGate] Sanitize stream name in all metrics.Jun 23 2026, 11:17 AM

Change #1324331 had a related patch set uploaded (by TChin; author: TChin):

[operations/deployment-charts@master] [eventgate] Bump to v1.32.0, make eventgate-analytics auto-refresh stream configs

https://gerrit.wikimedia.org/r/1324331

Change #1324331 merged by jenkins-bot:

[operations/deployment-charts@master] [eventgate] Bump to v1.32.0, make eventgate-analytics auto-refresh stream configs

https://gerrit.wikimedia.org/r/1324331