Event schema
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | Event receive time. |
| event_name | Utf8 | Stable logical event name. |
| schema_version | Utf8 | Explicit contract version such as v2. |
| producer_version | Utf8 | Application build or worker release. |
Copy the query
WITH version_counts AS (
SELECT
event_name,
producer_version,
schema_version,
COUNT(*) AS events
FROM product_events
WHERE timestamp_utc >= now() - INTERVAL '24 hours'
GROUP BY event_name, producer_version, schema_version
),
producer_totals AS (
SELECT
event_name,
producer_version,
SUM(events) AS producer_events
FROM version_counts
GROUP BY event_name, producer_version
)
SELECT
counts.event_name,
counts.producer_version,
counts.schema_version,
counts.events,
100.0 * counts.events / NULLIF(totals.producer_events, 0)
AS version_share_pct
FROM version_counts AS counts
JOIN producer_totals AS totals
ON totals.event_name = counts.event_name
AND totals.producer_version = counts.producer_version
ORDER BY counts.event_name, counts.producer_version, counts.events DESC;This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. We review the synthetic sample output separately. Check field types, thresholds, and counting rules against your own data. Read the testing methodology.
Query result
Schema-version share by producer
The web deployment has converged on v2, while a worker release still emits a substantial v1 share.
| event_name | producer_version | schema_version | events | version_share_pct |
|---|---|---|---|---|
| checkout_completed | web-1848 | v2 | 9,840 | 99.72 |
| checkout_completed | worker-411 | v1 | 742 | 38.11 |
Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.
Reproduce the example
Download the sample data
The JSON bundle includes the event schema with field types, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.
How the SQL works
- 1The first CTE counts every observed event contract by producer and schema version.
- 2Producer totals create the denominator needed to compare high- and low-volume releases fairly.
- 3Keeping both versions in the output makes a mixed rollout visible instead of reporting only the newest version.
Edge cases to check
- Unversioned historical events need an explicit legacy label rather than a silent NULL.
- Mobile and desktop clients can have much longer rollout windows than server releases.
- A version label is useful only when semantic changes are documented alongside it.
Recommended dashboard
- Bars: version_share_pct by producer_version
- Trend: legacy version share over deployment time
- Table: event names with more than one active version
Alert guidance
Alert when a server-side producer keeps emitting a retired contract beyond the migration window; use longer review windows for client releases.
Read alert setupSet up the events this query needs
Related instrumentation and guides
Continue the analysis
Count sensor deliveries and measurements separately
Run SQL on six fictional sensor deliveries. A network retry adds rows without adding measurements, changing a row-weighted average.
Open recipeMeasure event ingestion freshness
Find event sources that stopped delivering data or are arriving substantially later than they occurred.
Open recipeFind duplicate event ids
Identify event identifiers delivered more than once and measure whether duplicate handling is working.
Open recipeRun it on your events
Create a table, adapt the fields, and save the result
Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.