1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Put push log "hookWait" to data export and add all wait values to UI

Summary:
Depends on D19797. Ref T13216.

  - Put the new `hookWait` in the export and the UI.
  - Put the existing waits in the UI, not just the export.
  - Make order consistent: host, write, read, hook (this is the order the timers start in).

Test Plan: Pushed some stuff, viewed web UI and saw sensible numbers, exported data and got the same values.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13216

Differential Revision: https://secure.phabricator.com/D19798
This commit is contained in:
epriestley 2018-11-08 09:36:50 -08:00
parent 2a7ac8e388
commit 1d7c960531
3 changed files with 38 additions and 8 deletions

View file

@ -410,8 +410,8 @@ final class DiffusionRepositoryClusterEngine extends Phobject {
$log = $this->logger;
if ($log) {
$log->writeClusterEngineLogProperty('readWait', $read_wait);
$log->writeClusterEngineLogProperty('writeWait', $write_wait);
$log->writeClusterEngineLogProperty('readWait', $read_wait);
}
}

View file

@ -41,9 +41,10 @@ final class DiffusionPushLogListView extends AphrontView {
$any_host = false;
foreach ($logs as $log) {
$repository = $log->getRepository();
$event = $log->getPushEvent();
if ($remotes_visible) {
$remote_address = $log->getPushEvent()->getRemoteAddress();
$remote_address = $event->getRemoteAddress();
} else {
$remote_address = null;
}
@ -79,10 +80,10 @@ final class DiffusionPushLogListView extends AphrontView {
phutil_tag('br'),
$flag_names);
$reject_code = $log->getPushEvent()->getRejectCode();
$reject_code = $event->getRejectCode();
if ($reject_code == $reject_herald) {
$rule_phid = $log->getPushEvent()->getRejectDetails();
$rule_phid = $event->getRejectDetails();
$handle = $viewer->renderHandle($rule_phid);
$reject_label = pht('Blocked: %s', $handle);
} else {
@ -92,6 +93,11 @@ final class DiffusionPushLogListView extends AphrontView {
pht('Unknown ("%s")', $reject_code));
}
$host_wait = $this->formatMicroseconds($event->getHostWait());
$write_wait = $this->formatMicroseconds($event->getWriteWait());
$read_wait = $this->formatMicroseconds($event->getReadWait());
$hook_wait = $this->formatMicroseconds($event->getHookWait());
$rows[] = array(
phutil_tag(
'a',
@ -107,7 +113,7 @@ final class DiffusionPushLogListView extends AphrontView {
$repository->getDisplayName()),
$viewer->renderHandle($log->getPusherPHID()),
$remote_address,
$log->getPushEvent()->getRemoteProtocol(),
$event->getRemoteProtocol(),
$device,
$log->getRefType(),
$log->getRefName(),
@ -121,6 +127,10 @@ final class DiffusionPushLogListView extends AphrontView {
$flag_names,
$reject_label,
$viewer->formatShortDateTime($log->getEpoch()),
$host_wait,
$write_wait,
$read_wait,
$hook_wait,
);
}
@ -140,6 +150,10 @@ final class DiffusionPushLogListView extends AphrontView {
pht('Flags'),
pht('Result'),
pht('Date'),
pht('Host Wait'),
pht('Write Wait'),
pht('Read Wait'),
pht('Hook Wait'),
))
->setColumnClasses(
array(
@ -156,6 +170,10 @@ final class DiffusionPushLogListView extends AphrontView {
'',
'',
'right',
'n right',
'n right',
'n right',
'n right',
))
->setColumnVisibility(
array(
@ -170,4 +188,12 @@ final class DiffusionPushLogListView extends AphrontView {
return $table;
}
private function formatMicroseconds($duration) {
if ($duration === null) {
return null;
}
return pht('%sus', new PhutilNumber($duration));
}
}

View file

@ -162,6 +162,9 @@ final class PhabricatorRepositoryPushLogSearchEngine
id(new PhabricatorStringExportField())
->setKey('resultDetails')
->setLabel(pht('Result Details')),
id(new PhabricatorIntExportField())
->setKey('hostWait')
->setLabel(pht('Host Wait (us)')),
id(new PhabricatorIntExportField())
->setKey('writeWait')
->setLabel(pht('Write Wait (us)')),
@ -169,8 +172,8 @@ final class PhabricatorRepositoryPushLogSearchEngine
->setKey('readWait')
->setLabel(pht('Read Wait (us)')),
id(new PhabricatorIntExportField())
->setKey('hostWait')
->setLabel(pht('Host Wait (us)')),
->setKey('hookWait')
->setLabel(pht('Hook Wait (us)')),
);
if ($viewer->getIsAdmin()) {
@ -251,9 +254,10 @@ final class PhabricatorRepositoryPushLogSearchEngine
'result' => $result,
'resultName' => $result_name,
'resultDetails' => $event->getRejectDetails(),
'hostWait' => $event->getHostWait(),
'writeWait' => $event->getWriteWait(),
'readWait' => $event->getReadWait(),
'hostWait' => $event->getHostWait(),
'hookWait' => $event->getHookWait(),
);
if ($viewer->getIsAdmin()) {