Align report queries with the deployed Athena schema - #4
Closed
bryanfriedman wants to merge 2 commits into
Closed
Conversation
Point every report at the `traces` table rather than the placeholder `trace` name, and pin the tenant with a `<your-tenant>` placeholder so the queries run against the injected tenant partition. Add a `type` filter to the six reports that analyze a single command stage, so partition pruning applies and stage re-emission cannot double count. Leave it off the build reports, which dedupe on buildId and would undercount if pinned to type = 'build', and off top-users, which reads run and commit columns from the same rows. Fix inflated totals in the dashboard KPIs. Both queries summed run-stage columns across every trace that re-emits them, counting a single run once per later stage. Collapse to one row per (runId, path) before aggregating. Update the affected header comments and READMEs to match the new scoping.
Contributor
Author
|
Superseding with #5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three fixes, applied across all ten templates:
1. Wrong table name
Queries read
FROM trace. The table istraces.2. Missing type scoping (double counting)
Run-stage columns are re-emitted by every later-stage trace (
apply,add,commit), soWHERE runOutcome IS NOT NULLmatches the same run several times.type = 'run'torecipe-run-trend,top-recipes.type = 'commit'tocommit-activity,commit-trend,security-recipe-run-trend,top-recipes-with-commits.build-success-trend/build-tool-distribution: they dedupe onbuildId, and pinningtype = 'build'would undercount builds that only appear in later-stage traces.top-users: it reads run and commit columns from the same rows, so a type filter would force commits to zero. It uses onlyCOUNT(DISTINCT ...), so it is already correct.Bug fix: dashboard KPIs inflated ~4x
dashboard-kpiswas the only template mixing rawSUM()with arunOutcomefilter that spans four types:estimated_hours_savedandfiles_changedwere inflated up to 4x. Both queries now collapse to one row per(runId, path)(one repository's participation in one run) before aggregating. This is the same class of bug as Deduplicate commit metrics so stage re-emission does not inflate totals #2, which fixed the commit metrics.Headers and the two affected READMEs were updated so no prose contradicts the new scoping. The
build,top-users, anddashboard-kpisnotes about later-stage traces are still accurate and were left alone.