Event contract
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | When the event occurred. |
| team_id | Utf8 | Stable account or workspace identifier. |
| event_name | Utf8 | Product event name. |
| feature_name | Utf8 | Stable feature identifier for feature_used events. |
Copy the query
WITH upgrades AS (
SELECT
team_id,
MIN(timestamp_utc) AS upgraded_at
FROM product_events
WHERE event_name = 'plan_upgraded'
GROUP BY team_id
),
pre_upgrade_features AS (
SELECT DISTINCT
e.team_id,
e.feature_name
FROM product_events e
JOIN upgrades u ON e.team_id = u.team_id
WHERE e.event_name = 'feature_used'
AND e.timestamp_utc < u.upgraded_at
AND e.timestamp_utc >= u.upgraded_at - INTERVAL '30 days'
)
SELECT
feature_name,
COUNT(DISTINCT team_id) AS upgraded_teams_using_feature
FROM pre_upgrade_features
GROUP BY feature_name
ORDER BY upgraded_teams_using_feature DESC;This recipe is read-only and reviewed against Telemetry's DataFusion query patterns. Sample output is deterministic and synthetic; validate field types, thresholds, and business definitions against your own data.
Query result
Feature adoption among upgraded teams
Shared dashboards are the most common pre-upgrade behavior in this synthetic example.
| feature_name | upgraded_teams_using_feature |
|---|---|
| shared_dashboard | 184 |
| alert_created | 151 |
| scheduled_export | 112 |
| ai_query | 97 |
Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.
How the SQL works
- 1The upgrades CTE finds the first upgrade time per team.
- 2The join limits feature activity to the thirty days before that upgrade, preventing post-upgrade adoption from contaminating the result.
- 3DISTINCT team and feature pairs ensure heavy users do not dominate the ranking.
Edge cases to decide
- Compare against non-upgraded teams before treating a common feature as predictive.
- Control for account size, plan eligibility, and tenure where those variables influence both adoption and upgrade.
- Use exposure events when a feature is not available to every account.
Recommended dashboard
- Bar chart: upgraded_teams_using_feature
- Comparison table: adoption among upgraded vs eligible non-upgraded teams
- Line chart: time from first feature use to upgrade
Alert guidance
This is a product-learning query, not an operational alert. Schedule it as a weekly dashboard review.
Read alert setupPut the recipe to work
Related instrumentation and guides
Continue the analysis
Build a Signup-to-Activation Funnel in SQL
Calculate unique-user conversion through signup, onboarding, integration, and first-value milestones.
Open recipeCalculate Weekly Cohort Retention
Group users by first activity week and measure the percentage returning in later weeks.
Open recipeCalculate DAU, WAU, and Product Stickiness
Measure daily and weekly active users together and calculate DAU-to-WAU stickiness from a consistent activity definition.
Open recipeRun it on real 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.