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; $log = $this->logger;
if ($log) { if ($log) {
$log->writeClusterEngineLogProperty('readWait', $read_wait);
$log->writeClusterEngineLogProperty('writeWait', $write_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; $any_host = false;
foreach ($logs as $log) { foreach ($logs as $log) {
$repository = $log->getRepository(); $repository = $log->getRepository();
$event = $log->getPushEvent();
if ($remotes_visible) { if ($remotes_visible) {
$remote_address = $log->getPushEvent()->getRemoteAddress(); $remote_address = $event->getRemoteAddress();
} else { } else {
$remote_address = null; $remote_address = null;
} }
@ -79,10 +80,10 @@ final class DiffusionPushLogListView extends AphrontView {
phutil_tag('br'), phutil_tag('br'),
$flag_names); $flag_names);
$reject_code = $log->getPushEvent()->getRejectCode(); $reject_code = $event->getRejectCode();
if ($reject_code == $reject_herald) { if ($reject_code == $reject_herald) {
$rule_phid = $log->getPushEvent()->getRejectDetails(); $rule_phid = $event->getRejectDetails();
$handle = $viewer->renderHandle($rule_phid); $handle = $viewer->renderHandle($rule_phid);
$reject_label = pht('Blocked: %s', $handle); $reject_label = pht('Blocked: %s', $handle);
} else { } else {
@ -92,6 +93,11 @@ final class DiffusionPushLogListView extends AphrontView {
pht('Unknown ("%s")', $reject_code)); 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( $rows[] = array(
phutil_tag( phutil_tag(
'a', 'a',
@ -107,7 +113,7 @@ final class DiffusionPushLogListView extends AphrontView {
$repository->getDisplayName()), $repository->getDisplayName()),
$viewer->renderHandle($log->getPusherPHID()), $viewer->renderHandle($log->getPusherPHID()),
$remote_address, $remote_address,
$log->getPushEvent()->getRemoteProtocol(), $event->getRemoteProtocol(),
$device, $device,
$log->getRefType(), $log->getRefType(),
$log->getRefName(), $log->getRefName(),
@ -121,6 +127,10 @@ final class DiffusionPushLogListView extends AphrontView {
$flag_names, $flag_names,
$reject_label, $reject_label,
$viewer->formatShortDateTime($log->getEpoch()), $viewer->formatShortDateTime($log->getEpoch()),
$host_wait,
$write_wait,
$read_wait,
$hook_wait,
); );
} }
@ -140,6 +150,10 @@ final class DiffusionPushLogListView extends AphrontView {
pht('Flags'), pht('Flags'),
pht('Result'), pht('Result'),
pht('Date'), pht('Date'),
pht('Host Wait'),
pht('Write Wait'),
pht('Read Wait'),
pht('Hook Wait'),
)) ))
->setColumnClasses( ->setColumnClasses(
array( array(
@ -156,6 +170,10 @@ final class DiffusionPushLogListView extends AphrontView {
'', '',
'', '',
'right', 'right',
'n right',
'n right',
'n right',
'n right',
)) ))
->setColumnVisibility( ->setColumnVisibility(
array( array(
@ -170,4 +188,12 @@ final class DiffusionPushLogListView extends AphrontView {
return $table; 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()) id(new PhabricatorStringExportField())
->setKey('resultDetails') ->setKey('resultDetails')
->setLabel(pht('Result Details')), ->setLabel(pht('Result Details')),
id(new PhabricatorIntExportField())
->setKey('hostWait')
->setLabel(pht('Host Wait (us)')),
id(new PhabricatorIntExportField()) id(new PhabricatorIntExportField())
->setKey('writeWait') ->setKey('writeWait')
->setLabel(pht('Write Wait (us)')), ->setLabel(pht('Write Wait (us)')),
@ -169,8 +172,8 @@ final class PhabricatorRepositoryPushLogSearchEngine
->setKey('readWait') ->setKey('readWait')
->setLabel(pht('Read Wait (us)')), ->setLabel(pht('Read Wait (us)')),
id(new PhabricatorIntExportField()) id(new PhabricatorIntExportField())
->setKey('hostWait') ->setKey('hookWait')
->setLabel(pht('Host Wait (us)')), ->setLabel(pht('Hook Wait (us)')),
); );
if ($viewer->getIsAdmin()) { if ($viewer->getIsAdmin()) {
@ -251,9 +254,10 @@ final class PhabricatorRepositoryPushLogSearchEngine
'result' => $result, 'result' => $result,
'resultName' => $result_name, 'resultName' => $result_name,
'resultDetails' => $event->getRejectDetails(), 'resultDetails' => $event->getRejectDetails(),
'hostWait' => $event->getHostWait(),
'writeWait' => $event->getWriteWait(), 'writeWait' => $event->getWriteWait(),
'readWait' => $event->getReadWait(), 'readWait' => $event->getReadWait(),
'hostWait' => $event->getHostWait(), 'hookWait' => $event->getHookWait(),
); );
if ($viewer->getIsAdmin()) { if ($viewer->getIsAdmin()) {