|
2 | 2 | <label>Code Scanning Alerts</label>
|
3 | 3 | <search id="baseSearch">
|
4 | 4 | <query>
|
5 |
| - `github_webhooks` (eventtype="GitHub::CodeScanning" OR eventtype="GitHub::Push") | eval action='action', tool=if(isnotnull('alert.tool.name'),'alert.tool.name','unknown'), repository=if(isnotnull('repository.name'),'repository.name','unknown'), severity=if(isnotnull('alert.rule.security_severity_level'),'alert.rule.security_severity_level','none'), create_time=if(isnotnull('alert.created_at'),'alert.created_at','unknown'), received_time='_time', alert_url=if(isnotnull('alert.html_url'),'alert.html_url','unknown'), eventtype='eventtype', created=strptime(create_time, "%Y-%m-%dT%H:%M:%S%Z"), duration=received_time - created, duration_str=tostring(avg(duration), "duration") |
| 5 | + `github_webhooks` (eventtype="GitHub::CodeScanning" OR eventtype="GitHub::Push") | eval action='action', tool=if(isnotnull('alert.tool.name'),'alert.tool.name','unknown'), repository=if(isnotnull('repository.name'),'repository.name','unknown'), severity=if(isnotnull('alert.rule.security_severity_level'),'alert.rule.security_severity_level','none'), create_time=if(isnotnull('alert.created_at'),'alert.created_at','unknown'), received_time='_time', alert_url=if(isnotnull('alert.html_url'),'alert.html_url','unknown'), eventtype='eventtype', created=strptime(create_time, "%Y-%m-%dT%H:%M:%S%Z"), resolved_at=case('alert.dismissed_at' != "null", 'alert.dismissed_at', isnotnull('alert.fixed_at'), 'alert.fixed_at', isnotnull('alert.resolved_at'),'alert.resolved_at', 1=1, _time), duration = toString(round(strptime(resolved_at, "%Y-%m-%dT%H:%M:%S") - strptime(create_time, "%Y-%m-%dT%H:%M:%S"))), duration_str=tostring(avg(duration), "duration") |
6 | 6 | </query>
|
7 | 7 | <earliest>$timeTkn.earliest$</earliest>
|
8 | 8 | <latest>$timeTkn.latest$</latest>
|
|
46 | 46 | </fieldset>
|
47 | 47 | <row>
|
48 | 48 | <panel>
|
| 49 | + <title>Mean Time to Resolution (MTTR)</title> |
| 50 | + <single> |
| 51 | + <search base="baseSearch"> |
| 52 | + <query>| search eventtype="GitHub::CodeScanning" (action=fixed OR action=closed_by_user) tool=$tool_name$ repository=$repoTkn$ |
| 53 | +| eval action=action, , repository=if(isnotnull('repository.name'),'repository.name','unknown') |
| 54 | +| eval age = avg(duration) |
| 55 | +| appendpipe [ stats avg(age) as totalTime ] |
| 56 | +| eval mttr = toString(round(totalTime), "duration"), clean_mttr = replace (mttr , "\+" , " days, ") |
| 57 | +| stats max(clean_mttr) |
| 58 | + |
| 59 | + </query> |
| 60 | + </search> |
| 61 | + <option name="drilldown">none</option> |
| 62 | + </single> |
| 63 | + </panel> |
| 64 | + <panel> |
| 65 | + <title>Created</title> |
49 | 66 | <single>
|
50 |
| - <title>Created</title> |
51 | 67 | <search base="baseSearch">
|
52 | 68 | <query>| search tool=$tool_name$ repository=$repoTkn$ action="created" | stats count</query>
|
53 | 69 | </search>
|
54 | 70 | <option name="drilldown">none</option>
|
55 |
| - <option name="height">50</option> |
| 71 | + <option name="height">100</option> |
56 | 72 | <option name="rangeColors">["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]</option>
|
57 | 73 | <option name="refresh.display">progressbar</option>
|
58 | 74 | </single>
|
59 | 75 | </panel>
|
60 | 76 | <panel>
|
| 77 | + <title>Fixed</title> |
61 | 78 | <single>
|
62 |
| - <title>Fixed</title> |
63 | 79 | <search base="baseSearch">
|
64 | 80 | <query>| search tool=$tool_name$ repository=$repoTkn$ action="fixed" | stats count</query>
|
65 | 81 | </search>
|
66 | 82 | <option name="drilldown">none</option>
|
67 |
| - <option name="height">50</option> |
| 83 | + <option name="height">100</option> |
68 | 84 | <option name="refresh.display">progressbar</option>
|
69 | 85 | </single>
|
70 | 86 | </panel>
|
71 | 87 | <panel>
|
| 88 | + <title>Reopened</title> |
72 | 89 | <single>
|
73 |
| - <title>Reopened</title> |
74 | 90 | <search base="baseSearch">
|
75 | 91 | <query>| search tool=$tool_name$ repository=$repoTkn$ action="reopened" | stats count</query>
|
76 | 92 | </search>
|
77 | 93 | <option name="drilldown">none</option>
|
78 |
| - <option name="height">50</option> |
| 94 | + <option name="height">100</option> |
79 | 95 | <option name="refresh.display">progressbar</option>
|
80 | 96 | </single>
|
81 | 97 | </panel>
|
82 | 98 | </row>
|
83 | 99 | <row>
|
84 | 100 | <panel>
|
| 101 | + <title>Alert Found/Fixed Ratio</title> |
85 | 102 | <chart>
|
86 |
| - <title>Alert Found/Fixed Ratio</title> |
87 | 103 | <search base="baseSearch">
|
88 | 104 | <query>| search tool=$tool_name$ repository=$repoTkn$ (action=created OR action=fixed)
|
89 |
| -| timechart count(_raw) by action |
| 105 | +| timechart count(_raw) by action |
90 | 106 | | accum created
|
91 |
| -| accum fixed |
92 |
| -| rename created as "Found" |
| 107 | +| accum fixed |
| 108 | +| rename created as "Found" |
93 | 109 | | rename fixed as "Fixed"</query>
|
94 | 110 | </search>
|
95 | 111 | <option name="charting.axisTitleX.visibility">collapsed</option>
|
96 | 112 | <option name="charting.chart">line</option>
|
97 | 113 | <option name="charting.drilldown">none</option>
|
98 |
| - <option name="refresh.display">progressbar</option> |
99 | 114 | <option name="height">150</option>
|
| 115 | + <option name="refresh.display">progressbar</option> |
100 | 116 | </chart>
|
101 | 117 | </panel>
|
102 | 118 | <panel>
|
| 119 | + <title>Commit/Alert Ratio</title> |
103 | 120 | <chart>
|
104 |
| - <title>Commit/Alert Ratio</title> |
105 | 121 | <search base="baseSearch">
|
106 | 122 | <query>| search (eventtype="GitHub::Push" repository=$repoTkn$) OR ((action=created OR action=reopened) tool=$tool_name$ repository=$repoTkn$ )
|
107 | 123 | | timechart count(_raw) by eventtype
|
|
122 | 138 | </chart>
|
123 | 139 | </panel>
|
124 | 140 | <panel>
|
| 141 | + <title>New Alerts by Tool</title> |
125 | 142 | <chart>
|
126 |
| - <title>New Alerts by Tool</title> |
127 | 143 | <search base="baseSearch">
|
128 | 144 | <query>| search tool=$tool_name$ repository=$repoTkn$ (action=created OR action=appeared_in_branch) | timechart count(_raw) by tool</query>
|
129 | 145 | </search>
|
|
141 | 157 | <title>Fixed Alerts</title>
|
142 | 158 | <search base="baseSearch">
|
143 | 159 | <query> | search (action=fixed OR action=closed_by_user) repository=$repoTkn$ tool=$tool_name$
|
144 |
| -| table repository, tool, alert_url,duration_str |
145 |
| -| rename repository AS "Repository" duration_str AS "Time to Resolution",tool AS "Tool", alert_url AS "Alert URL" |
| 160 | +|eval clean_duration = replace (duration_str , "\+" , " days, ") |
| 161 | +| table repository, tool, alert_url,clean_duration |
| 162 | +| rename repository AS "Repository" clean_duration AS "Time to Resolution",tool AS "Tool", alert_url AS "Alert URL" |
146 | 163 | | sort -"Time to Resolution"
|
147 | 164 | </query>
|
148 | 165 | </search>
|
|
157 | 174 | <search base="baseSearch">
|
158 | 175 | <query>| search (action=created OR action=reopened) repository=$repoTkn$ tool=$tool_name$ | chart usenull=f count over repository by severity</query>
|
159 | 176 | </search>
|
| 177 | + <option name="dataOverlayMode">heatmap</option> |
160 | 178 | <option name="drilldown">none</option>
|
161 |
| - <format type="color" field="critical"> |
162 |
| - <colorPalette type="minMidMax" maxColor="#DC4E41" minColor="#FFFFFF"></colorPalette> |
163 |
| - <scale type="minMidMax"></scale> |
164 |
| - </format> |
165 | 179 | <format type="color" field="high">
|
166 | 180 | <colorPalette type="minMidMax" maxColor="#F8BE34" minColor="#FFFFFF"></colorPalette>
|
167 | 181 | <scale type="minMidMax"></scale>
|
|
0 commit comments