Event schema
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | Event occurrence time. |
| event_name | Utf8 | Stable event contract name. |
| account_id | Utf8 | Account identifier required for these events. |
| producer_version | Utf8 | Application version that emitted the event. |
Copy the query
SELECT
event_name,
producer_version,
COUNT(*) AS events,
SUM(CASE
WHEN account_id IS NULL OR trim(account_id) = '' THEN 1
ELSE 0
END) AS missing_account_id,
100.0 * SUM(CASE
WHEN account_id IS NULL OR trim(account_id) = '' THEN 1
ELSE 0
END) / NULLIF(COUNT(*), 0) AS missing_rate_pct
FROM product_events
WHERE timestamp_utc >= now() - INTERVAL '24 hours'
GROUP BY event_name, producer_version
HAVING COUNT(*) >= 20
ORDER BY missing_rate_pct DESC, 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
Missing account ID rate by event and producer
The dashboard event has a version-specific completeness regression.
| event_name | producer_version | events | missing_account_id | missing_rate_pct |
|---|---|---|---|---|
| dashboard_viewed | web-1842 | 6,420 | 1,187 | 18.49 |
| query_completed | api-918 | 3,810 | 7 | 0.18 |
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 CASE expression treats both NULL and an empty string as missing.
- 2Grouping by producer_version makes deployment regressions easier to isolate.
- 3The minimum-volume rule prevents a handful of development events from dominating the report.
Edge cases to check
- Only evaluate a field on event contracts where it is truly required.
- Anonymous product events may legitimately lack account_id and should use a separate completeness rule.
- A placeholder such as unknown is not NULL but can still hide missing identity; measure sentinel values separately.
Recommended dashboard
- Bars: missing_rate_pct by event_name and producer_version
- Trend: completeness rate for critical contracts
- Table: recent rows missing the required field
Alert guidance
Alert when a critical event contract exceeds its documented missing-field budget at meaningful volume.
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.