1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Allow Multimeter samples to be grouped by ID

Summary: Ref T6930. This allows samples to be split apart even if they occurred in the same request.

Test Plan: {F391657}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6930

Differential Revision: https://secure.phabricator.com/D12676
This commit is contained in:
epriestley 2015-05-04 10:06:43 -07:00
parent bee4dc7d53
commit 77250cd54c

View file

@ -84,6 +84,15 @@ final class MultimeterSampleController extends MultimeterController {
$rows = array(); $rows = array();
foreach ($data as $row) { foreach ($data as $row) {
if ($row['N'] == 1) {
$events_col = $row['id'];
} else {
$events_col = $this->renderGroupingLink(
$group,
'id',
pht('%s Events', new PhutilNumber($row['N'])));
}
if (isset($group['request'])) { if (isset($group['request'])) {
$request_col = $row['requestKey']; $request_col = $row['requestKey'];
if (!$with['request']) { if (!$with['request']) {
@ -168,9 +177,7 @@ final class MultimeterSampleController extends MultimeterController {
} }
$rows[] = array( $rows[] = array(
($row['N'] == 1) $events_col,
? $row['id']
: pht('%s Events', new PhutilNumber($row['N'])),
$request_col, $request_col,
$viewer_col, $viewer_col,
$context_col, $context_col,
@ -209,7 +216,7 @@ final class MultimeterSampleController extends MultimeterController {
)) ))
->setColumnClasses( ->setColumnClasses(
array( array(
'n', null,
null, null,
null, null,
null, null,
@ -241,6 +248,7 @@ final class MultimeterSampleController extends MultimeterController {
'viewer' => pht('By Viewer'), 'viewer' => pht('By Viewer'),
'request' => pht('By Request'), 'request' => pht('By Request'),
'label' => pht('By Label'), 'label' => pht('By Label'),
'id' => pht('By ID'),
); );
$parts = array(); $parts = array();
@ -264,17 +272,21 @@ final class MultimeterSampleController extends MultimeterController {
)); ));
} }
private function renderGroupingLink(array $group, $key) { private function renderGroupingLink(array $group, $key, $name = null) {
$group[] = $key; $group[] = $key;
$uri = $this->getGroupURI($group); $uri = $this->getGroupURI($group);
if ($name === null) {
$name = pht('(All)');
}
return phutil_tag( return phutil_tag(
'a', 'a',
array( array(
'href' => $uri, 'href' => $uri,
'style' => 'font-weight: bold', 'style' => 'font-weight: bold',
), ),
pht('(All)')); $name);
} }
private function getGroupURI(array $group, $wipe = false) { private function getGroupURI(array $group, $wipe = false) {
@ -318,6 +330,7 @@ final class MultimeterSampleController extends MultimeterController {
'viewer' => 'eventViewerID', 'viewer' => 'eventViewerID',
'request' => 'requestKey', 'request' => 'requestKey',
'label' => 'eventLabelID', 'label' => 'eventLabelID',
'id' => 'id',
); );
} }