-
Notifications
You must be signed in to change notification settings - Fork 21
add webcompat diagnosis lifetime dashboard #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
benoit-chauvet
wants to merge
4
commits into
mozilla:main
Choose a base branch
from
benoit-chauvet:diagnosis_lifetime
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
jobs/webcompat-kb/data/redash/webcompat_diagnosis_lifetime/meta.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| name = "webcompat_diagnosis_lifecycle" | ||
| description = "Webcompat Diagnosis Lifecycle" |
14 changes: 14 additions & 0 deletions
14
jobs/webcompat-kb/data/redash/webcompat_diagnosis_lifetime/parameters.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [from] | ||
| title = "From" | ||
| type = "date" | ||
| value = "2026-01-01" | ||
|
|
||
| [to] | ||
| title = "To" | ||
| type = "date" | ||
| value = "2026-04-30" | ||
|
|
||
| [metric] | ||
| title = "Metric" | ||
| type = "enum" | ||
| enum_options = [ {% for metric in metrics.values() %} "{{ metric.pretty_name }}", {% endfor %}] |
2 changes: 2 additions & 0 deletions
2
...dash/webcompat_diagnosis_lifetime/webcompat_bugs_diagnosis_lifetime_percentiles/meta.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| name = "Webcompat Bugs - Diagnosis Lifetime Percentiles" | ||
| id = 119310 |
75 changes: 75 additions & 0 deletions
75
...dash/webcompat_diagnosis_lifetime/webcompat_bugs_diagnosis_lifetime_percentiles/query.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| WITH | ||
| diagnosis_enter AS ( | ||
| SELECT | ||
| history.number, | ||
| history.change_time, | ||
| changes.added | ||
| FROM {{ ref ("webcompat_knowledge_base.bugs_history") }} AS history, | ||
| UNNEST (history.changes) as changes | ||
| WHERE changes.field_name LIKE '%keywords%' | ||
| AND changes.added LIKE'%webcompat:needs_diagnosis%' | ||
| ORDER BY history.number | ||
| ), | ||
| diagnosis_exit AS ( | ||
| SELECT | ||
| history.number, | ||
| history.change_time, | ||
| changes.removed | ||
| FROM {{ ref ("webcompat_knowledge_base.bugs_history") }} AS history, | ||
| UNNEST (history.changes) as changes | ||
| WHERE changes.field_name LIKE '%keywords%' | ||
| AND changes.removed LIKE'%webcompat:needs_diagnosis%' | ||
| ORDER BY history.number | ||
| ), | ||
| diagnosis_lifetimes AS ( | ||
| SELECT | ||
| site_reports.webcompat_priority, | ||
| DATE_DIFF(diagnosis_exit.change_time, diagnosis_enter.change_time, DAY) as lifetime_days | ||
| FROM diagnosis_enter diagnosis_enter | ||
| JOIN diagnosis_exit diagnosis_exit USING(number) | ||
| JOIN {{ ref ("webcompat_knowledge_base.scored_site_reports") }} AS site_reports USING(number) | ||
| WHERE site_reports.webcompat_priority IN ('P1', 'P2', 'P3') | ||
| AND DATE(site_reports.creation_time) BETWEEN DATE('{{ param("from") }}') AND DATE('{{ param("to") }}') | ||
| AND | ||
| CASE "{{ param("metric") }}" {% for metric in metrics.values() %} | ||
| WHEN "{{ metric.pretty_name }}" THEN {{ metric.condition("site_reports") }} | ||
| {%- endfor %} | ||
| ), | ||
| stats AS ( | ||
| SELECT | ||
| webcompat_priority, | ||
| COUNT(*) as total_bugs, | ||
| AVG(lifetime_days) as avg_lifetime, | ||
| APPROX_QUANTILES(lifetime_days, 100)[OFFSET(10)] as p10_days, | ||
| APPROX_QUANTILES(lifetime_days, 100)[OFFSET(25)] as p25_days, | ||
| APPROX_QUANTILES(lifetime_days, 100)[OFFSET(50)] as p50_days, | ||
| APPROX_QUANTILES(lifetime_days, 100)[OFFSET(75)] as p75_days, | ||
| APPROX_QUANTILES(lifetime_days, 100)[OFFSET(90)] as p90_days, | ||
| APPROX_QUANTILES(lifetime_days, 100)[OFFSET(100)] as p100_days | ||
| FROM diagnosis_lifetimes | ||
| GROUP BY webcompat_priority | ||
| ), | ||
| unpivoted AS ( | ||
| SELECT | ||
| webcompat_priority, | ||
| percentile, | ||
| resolved_in_days | ||
| FROM stats | ||
| CROSS JOIN UNNEST([ | ||
| STRUCT('p10' as percentile, p10_days as resolved_in_days), | ||
| STRUCT('p25', p25_days), | ||
| STRUCT('p50', p50_days), | ||
| STRUCT('p75', p75_days), | ||
| STRUCT('p90', p90_days), | ||
| STRUCT('p100', p100_days) | ||
| ]) | ||
| ) | ||
|
|
||
| SELECT | ||
| percentile, | ||
| MAX(CASE WHEN webcompat_priority = 'P1' THEN resolved_in_days END) as P1, | ||
| MAX(CASE WHEN webcompat_priority = 'P2' THEN resolved_in_days END) as P2, | ||
| MAX(CASE WHEN webcompat_priority = 'P3' THEN resolved_in_days END) as P3 | ||
| FROM unpivoted | ||
| GROUP BY percentile | ||
| ; |
2 changes: 2 additions & 0 deletions
2
...t-kb/data/redash/webcompat_diagnosis_lifetime/webcompat_bugs_diagnosis_survival/meta.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| name = "Webcompat - Diagnosis Survival Rate" | ||
| id = 119317 |
63 changes: 63 additions & 0 deletions
63
...t-kb/data/redash/webcompat_diagnosis_lifetime/webcompat_bugs_diagnosis_survival/query.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| WITH | ||
| diagnosis_enter AS ( | ||
| SELECT | ||
| history.number, | ||
| MIN(history.change_time) as enter_time | ||
| FROM {{ ref ("webcompat_knowledge_base.bugs_history") }} AS history, | ||
| UNNEST (history.changes) as changes | ||
| WHERE changes.field_name LIKE '%keywords%' | ||
| AND changes.added LIKE '%webcompat:needs_diagnosis%' | ||
| GROUP BY history.number | ||
| ), | ||
| diagnosis_exit AS ( | ||
| SELECT | ||
| history.number, | ||
| MIN(history.change_time) as exit_time | ||
| FROM {{ ref ("webcompat_knowledge_base.bugs_history") }} AS history, | ||
| UNNEST (history.changes) as changes | ||
| WHERE changes.field_name LIKE '%keywords%' | ||
| AND changes.removed LIKE '%webcompat:needs_diagnosis%' | ||
| GROUP BY history.number | ||
| ), | ||
| diagnosis_durations AS ( | ||
| SELECT | ||
| site_reports.webcompat_priority, | ||
| diagnosis_enter.number, | ||
| diagnosis_enter.enter_time, | ||
| diagnosis_exit.exit_time, | ||
| TIMESTAMP_DIFF(diagnosis_exit.exit_time, diagnosis_enter.enter_time, SECOND)/(3600*24) as days_in_status | ||
| FROM diagnosis_enter | ||
| INNER JOIN diagnosis_exit USING(number) | ||
| JOIN {{ ref ("webcompat_knowledge_base.scored_site_reports") }} AS site_reports USING(number) | ||
| WHERE site_reports.webcompat_priority IN ('P1', 'P2', 'P3') | ||
| AND DATE(site_reports.creation_time) BETWEEN DATE('{{ param("from") }}') AND DATE('{{ param("to") }}') | ||
| AND | ||
| CASE "{{ param("metric") }}" {% for metric in metrics.values() %} | ||
| WHEN "{{ metric.pretty_name }}" THEN {{ metric.condition("site_reports") }} | ||
| {%- endfor %} | ||
| ), | ||
| totals AS ( | ||
| SELECT | ||
| webcompat_priority, COUNT(*) as total | ||
| FROM diagnosis_durations | ||
| GROUP BY webcompat_priority | ||
| ), | ||
| counts AS ( | ||
| SELECT | ||
| day, | ||
| COUNTIF(d.webcompat_priority = 'P1' AND d.days_in_status >= day) as open_p1, | ||
| COUNTIF(d.webcompat_priority = 'P2' AND d.days_in_status >= day) as open_p2, | ||
| COUNTIF(d.webcompat_priority = 'P3' AND d.days_in_status >= day) as open_p3 | ||
| FROM UNNEST(GENERATE_ARRAY(0, 90)) as day | ||
| LEFT JOIN diagnosis_durations d ON TRUE | ||
| GROUP BY day | ||
| ) | ||
|
|
||
| SELECT | ||
| day, | ||
| SAFE_DIVIDE(open_p1, (SELECT total FROM totals WHERE webcompat_priority = 'P1')) as P1, | ||
| SAFE_DIVIDE(open_p2, (SELECT total FROM totals WHERE webcompat_priority = 'P2')) as P2, | ||
| SAFE_DIVIDE(open_p3, (SELECT total FROM totals WHERE webcompat_priority = 'P3')) as P3 | ||
| FROM counts | ||
| ORDER BY day | ||
| ; | ||
2 changes: 2 additions & 0 deletions
2
...ata/redash/webcompat_diagnosis_lifetime/webcompat_diagnosis_lifetime_statistics/meta.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| name = "Webcompat Diagnosis lifetime statistics" | ||
| id = 119315 |
67 changes: 67 additions & 0 deletions
67
...ata/redash/webcompat_diagnosis_lifetime/webcompat_diagnosis_lifetime_statistics/query.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| WITH | ||
| diagnosis_enter AS ( | ||
| SELECT | ||
| history.number, | ||
| MIN(history.change_time) as change_time | ||
| FROM {{ ref ("webcompat_knowledge_base.bugs_history") }} AS history, | ||
| UNNEST (history.changes) as changes | ||
| WHERE changes.field_name LIKE '%keywords%' | ||
| AND changes.added LIKE'%webcompat:needs_diagnosis%' | ||
| GROUP BY history.number | ||
| ), | ||
| diagnosis_exit AS ( | ||
| SELECT | ||
| history.number, | ||
| MAX(history.change_time) as change_time | ||
| FROM {{ ref ("webcompat_knowledge_base.bugs_history") }} AS history, | ||
| UNNEST (history.changes) as changes | ||
| WHERE changes.field_name LIKE '%keywords%' | ||
| AND changes.removed LIKE'%webcompat:needs_diagnosis%' | ||
| GROUP BY history.number | ||
| ), | ||
| lifetimes AS ( | ||
| SELECT | ||
| site_reports.webcompat_priority as priority, | ||
| COUNT(1) as bug_count, | ||
| APPROX_QUANTILES(DATETIME_DIFF(diagnosis_exit.change_time, diagnosis_enter.change_time, HOUR)/24, 100)[OFFSET(50)] as median_lifetime, | ||
| AVG(DATETIME_DIFF(diagnosis_exit.change_time, diagnosis_enter.change_time, HOUR)/24) as avg_lifetime, | ||
| MIN(DATETIME_DIFF(diagnosis_exit.change_time, diagnosis_enter.change_time, HOUR)/24) as min_lifetime, | ||
| MAX(DATETIME_DIFF(diagnosis_exit.change_time, diagnosis_enter.change_time, HOUR)/24) as max_lifetime, | ||
| FROM diagnosis_enter | ||
| JOIN diagnosis_exit USING(number) | ||
| JOIN {{ ref ("webcompat_knowledge_base.scored_site_reports") }} AS site_reports USING(number) | ||
| WHERE site_reports.webcompat_priority IN ('P1', 'P2', 'P3') | ||
| AND DATE(site_reports.creation_time) BETWEEN DATE('{{ param("from") }}') AND DATE('{{ param("to") }}') | ||
| AND | ||
| CASE "{{ param("metric") }}" {% for metric in metrics.values() %} | ||
| WHEN "{{ metric.pretty_name }}" THEN {{ metric.condition("site_reports") }} | ||
| {%- endfor %} | ||
| GROUP BY site_reports.webcompat_priority | ||
| ), | ||
| totals AS ( | ||
| SELECT | ||
| site_reports.webcompat_priority as priority, | ||
| COUNT(1) as total | ||
| FROM {{ ref ("webcompat_knowledge_base.scored_site_reports") }} AS site_reports | ||
| WHERE site_reports.webcompat_priority IN ('P1', 'P2', 'P3') | ||
| AND DATE(site_reports.creation_time) BETWEEN DATE('{{ param("from") }}') AND DATE('{{ param("to") }}') | ||
| AND | ||
| CASE "{{ param("metric") }}" {% for metric in metrics.values() %} | ||
| WHEN "{{ metric.pretty_name }}" THEN {{ metric.condition("site_reports") }} | ||
| {%- endfor %} | ||
| GROUP BY priority | ||
| ) | ||
|
|
||
| SELECT | ||
| lifetimes.priority as Priority, | ||
| totals.total as `Total created`, | ||
| lifetimes.bug_count as `Total diagnosed`, | ||
| lifetimes.bug_count/total * 100 as Ratio, | ||
| lifetimes.median_lifetime as `Median lifetime`, | ||
| lifetimes.avg_lifetime as `Average`, | ||
| lifetimes.min_lifetime as `Min`, | ||
| lifetimes.max_lifetime as `Max` | ||
| FROM lifetimes lifetimes | ||
| JOIN totals ON lifetimes.priority = totals.priority | ||
| ORDER BY priority | ||
| ; |
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.
Uh oh!
There was an error while loading. Please reload this page.