Bug 1627230 - Add retriggers to Push Health dashboard (#6485)

This commit is contained in:
Suyash Salampuria 2020-06-10 22:00:11 +05:30 коммит произвёл GitHub
Родитель fd7214783f
Коммит d3c57940d7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -1,7 +1,7 @@
import logging
from treeherder.config import settings
from treeherder.model.models import Push
from treeherder.model.models import Push, Job
from treeherder.push_health.classification import NEED_INVESTIGATION
from treeherder.utils.http import make_request
from treeherder.webapp.api.serializers import PushSerializer
@ -28,6 +28,11 @@ def get_latest(facet):
return {NEED_INVESTIGATION: latest['max'], 'time': item['endTimeSeconds']}
def jobs_retriggered(push):
retrigger_jobs = Job.objects.filter(push=push, job_type__name='Action: Retrigger')
return len(retrigger_jobs)
def get_usage():
nrql = "SELECT%20max(needInvestigation)%20FROM%20push_health_need_investigation%20FACET%20revision%20SINCE%201%20DAY%20AGO%20TIMESERIES%20where%20repo%3D'{}'%20AND%20appName%3D'{}'".format(
@ -54,6 +59,7 @@ def get_usage():
'push': PushSerializer(pushes.get(revision=facet['name'])).data,
'peak': get_peak(facet),
'latest': get_latest(facet),
'retriggers': jobs_retriggered(pushes.get(revision=facet['name'])),
}
for facet in data['facets']
]

Просмотреть файл

@ -51,6 +51,7 @@ class Usage extends Component {
<th>Latest</th>
<th>Latest Time</th>
<th>Delta</th>
<th>Retriggers</th>
</tr>
</thead>
<tbody>
@ -59,6 +60,7 @@ class Usage extends Component {
push: { revision, push_timestamp: pushTimestamp, author },
peak: { needInvestigation: peakNI, time: peakTime },
latest: { needInvestigation: latestNI, time: latestTime },
retriggers,
} = rev;
return (
@ -82,6 +84,7 @@ class Usage extends Component {
{peakNI - latestNI > 0 && peakNI - latestNI}
</Badge>
</td>
<td>{retriggers}</td>
</tr>
);
})}