Auto-Generated Monitoring of Event Data with Annotations

Salih Can28 Apr 2022

Problem

Tests do not catch everything that breaks for real users: missing translations, a button pushed off-screen by CSS, interactions between A/B experiments, outages of services that tests mock. A drop or spike in event counts (clicks, page views) is a cheap signal for all of these. At Udemy each team owns its events and knows what traffic is normal for them. But a hand-made monitor needs the author to know it is possible, pick the metric and configure it in the UI, so teams skip it.

Example from the article: a new AddToCartEvent (course ID and price) needs an alert if the number of add-to-cart events drops unexpectedly.

Solution in brief

Monitors are declared as annotations on the event schema, in the same pull request that defines the event. A schema-registration service parses the annotation, fills in default parameters and creates, updates or deletes the matching monitor through the monitoring tool's API.

Questions this case answers
  • How to get automatic anomaly alerts on every instrumented event stream when manual alert setup is skipped because it needs tool-specific knowledge
  • How to detect broken or missing user events in production without waiting for users to complain?
  • How to make teams create traffic monitors for their own events without learning the monitoring tool?
  • How to keep monitor definitions next to the event schema so they stay discoverable and versioned?

Tools and methods

  • Datadog — metrics, anomaly monitors, alerts to Slack or PagerDuty
  • Avro IDL schemas — event definitions in one GitHub repository; annotations on records carry monitor configs
  • Event Schema Manager (ESM) — Udemy's internal service triggered by GitHub webhooks that registers schemas and manages monitors
  • Anomaly detection — Datadog's anomaly monitor flags a metric that deviates from its own past behavior
Continue reading — it's free

Google or a one-time email code. No password.