How to save analysts' time and effort: our algorithm for detecting data anomalies

Yulia Zinovieva14 Sep 2023

Problem

Product analysts at an e-commerce marketplace rely on clickstream events, and their number almost doubled in a year. Events break in development, are not sent, are not stored or vanish, and autotests do not catch every case. A broken event can stay unnoticed for several releases. The article reports that 75% of product managers had postponed the launch or the wrap-up of A/B tests because of incorrect events, and critical bugs stopped releases for several days.

Example from the article: a test ran for two weeks with nobody looking at its metrics, then showed odd results because an event misbehaved in one app version, so the experiment had to be restarted.

Solution in brief

A daily job forecasts the row count of every event, builds a confidence interval around the forecast and flags any day whose actual count falls outside it. The forecast is a weighted moving average of rows per order, multiplied back by the day's orders. It cut the mean forecast error 4 times against a last-week baseline.

Questions this case answers
  • How to detect silent breakage in hundreds of event-count time series with weekly seasonality using a method any analyst can maintain
  • How to find out automatically that a clickstream event has broken or disappeared, before it spoils an A/B test or a metric investigation?
  • How to forecast the daily row count of hundreds of clickstream events well enough to flag anomalies without a heavy model?
  • How to keep daily data-quality alerts useful so that analysts do not start ignoring them?

Tools and methods

  • Weighted moving average on a normalized metric — forecast of the event's row count
  • Confidence interval on forecast residuals — normal range for each event
  • ClickHouse — clickstream storage
  • Apache Airflow — daily scheduled calculation
  • GitLab — calculation code and event documentation with owners
  • Messenger alerts — summary with links to charts and breakdowns
Continue reading — it's free

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