Peach · events pipeline
The life of one media_play event
A single tap on a video player, traced through every service it passes and every byte it leaves behind, from the browser to a rolled-up view a dashboard can read in under a second. Following the live AutoMQ → bridge → StarRocks path.
The app fires the event
pipe SDK, in the browser or mobile app
The player calls the SDK the moment playback starts. The SDK stamps the event, attaches device and client information (parsed later from the User-Agent), and buffers it with other events instead of sending one request per tap.
{
"type": "media_play",
"id": "urn:sesr:video:4471",
"event_timestamp": 1763385600061,
"props": { "time_spent_s": 123.3, "playback_position_s": 12.9 }
}- the SDK batches events in the client
- flushes on a timer or on page hide
- None durable. Lives in a JavaScript array; lost if the tab closes before the flush
HTTPS into the collector
peach-pipe-collect · aiohttp · 3–150 pods (autoscaling at 70% CPU)
The batch is POSTed to pipe-collect.ebu.io/v3/collect?s=sesr000000000019 through Traefik. The collector validates the site key against its allow-list, answers CORS and returns 201 fast. It does no analytics work: it gets the event onto a log.
- TLS termination and CORS preflight
- site-key allow-list check
- splits the batch into individual events
- produces to MSK with no partition key, so events round-robin across partitions
- None. Pure pass-through to Kafka: the collector keeps no copy
Lands on the raw topic (MSK)
MSK cluster peach2 · 3 brokers · topic sesr000000000019_events
The event becomes a record on sesr000000000019_events: the raw layer, one topic per site key, still the exact JSON the app sent. This is the pipeline's first durable copy and its replay point. Everything downstream can be rebuilt from here.
- MSK broker disks (EBS), replicated across 3 brokers
- retained per topic configuration: the durable source of truth for replay
- no key, so the event sits in a round-robin-chosen partition
The bridge makes it typed
peach-events-bridge · Deployment, autoscaling 2–12 pods
The bridge consumes raw JSON in batches of 5000, pulls the event type out of the payload and turns loose JSON into a strict Avro record. It does not guess the shape: each (codops, event_type) needs a schema you saved up front on the Schemas page. Saving it commits the schema to git and registers it in the Schema Registry, and the bridge picks it up within about 30 s. From then on the registered schema is the authority: fields it does not list are dropped, and fields it lists but the event lacks are null.
No schema yet? Events of that type go to the dead-letter queue as schema_not_registered and are counted on the Failures page. Nothing reaches StarRocks until you save the schema. The raw JSON is still on the raw topic, so you can bring the missed events in afterwards with Re-ingest. To add a field later, edit the schema first, then start sending it.
codops=sesr event_type=media_play id=urn:sesr:video:4471 collect_timestamp=1763385600061 // server-stamped props.time_spent_s=123.3
- extract the event type from the nested payload
- look up your saved schema, never infer one
- coerce values, Avro-serialise, compress
- no schema or a bad value goes to
sesr._dlq
- the Schema Registry holds
sesr.media_play-value, the schema you saved - source of truth is git (
event-schemas/); the registry follows
Avro topic on AutoMQ
AutoMQ · 3 brokers (Strimzi/KRaft) · the S3-backed Kafka
The bridge produces to sesr.media_play: the Avro layer, one topic per event type. A small slice lives on local disk just long enough to acknowledge the write, then the data is offloaded to S3. Durability comes from object storage, not from broker disks.
- Hot: 20 GiB of EBS per broker, the write-ahead log only, just the tail until it is flushed to S3
- Cold (S3): separate buckets for the write-ahead log, the log segments and the metadata
Routine Load pulls it into StarRocks
StarRocks Routine Load rl_media_play · runs on CN nodes
A continuous routine load, one per event type per codops, subscribes to the Avro topic as its own consumer group. It flattens nested fields, derives a _partition_ts from collect_timestamp and appends the row to peach_events_sesr.media_play. It does not commit per message: it batches for up to about 280 s, then writes once.
_partition_ts metadata_id time_spent_s 2026-11-17 urn:sesr:video:4471 123.3
- CN nodes decode Avro, flatten and cast types
- derive
_partition_ts, which sets the day partition - concurrency follows the live CN count
- the row lands in a day-partitioned table,
peach_events_sesr.media_play, on the codops storage volume in S3 - each commit writes about 11.6 S3 objects, which is why the batch is slow
Folded into the daily view
Materialized view mv_media_play_daily · refreshed asynchronously every 15 min
The row is not queried directly. Within 15 minutes StarRocks recomputes the day's partition of mv_media_play_daily: a count of plays grouped by day and media item. The event stops being a row and becomes +1 on a number. Only the last 8 days ever refresh, so the cost is bounded.
day metadata_id plays 2026-11-17 urn:sesr:video:4471 8814 // our +1 is in here
- CN nodes aggregate the day's partition, with no cron: StarRocks does it natively
- bounded by
auto_refresh_partitions_limitof 8 days
- a day-partitioned view table on the same codops volume
- tiny compared with the raw rows: millions of rows become one row per day and item
A dashboard reads it instantly
Superset chart on sesr.peach.ebu.io
A "plays per item, today" chart queries the view, not the raw table. It touches one small day partition of a pre-aggregated view instead of scanning millions of event rows, which is why the full dashboard renders in about 0.6 s instead of about 30 s.
- a point read of one view day partition, 90–200× faster than scanning raw events
What the event left behind
- Raw: JSON on MSK (
sesr…_events), the replay source - Typed: Avro on AutoMQ, in S3
- Row: in
peach_events_sesr.media_play, on S3 - Aggregate: a +1 inside
mv_media_play_daily
- collector: validate and forward, no state
- bridge: apply your saved schema, serialise to Avro
- routine load: flatten, cast, partition, batch commit
- view refresh: aggregate the day, every 15 min
Reading this trace: the live canonical path is collect → MSK → bridge → AutoMQ → StarRocks. A separate legacy partitioner writes Parquet to S3 off the same raw layer, in parallel and not part of this journey. Topic and bucket names follow the prod-2 convention; exact retention and batch settings are per-topic annotations. Timings (0.6 s, 15 min, ~280 s, 8-day window) are from the pipeline docs, not measured for this specific event.