1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +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();
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'])) {
$request_col = $row['requestKey'];
if (!$with['request']) {
@ -168,9 +177,7 @@ final class MultimeterSampleController extends MultimeterController {
}
$rows[] = array(
($row['N'] == 1)
? $row['id']
: pht('%s Events', new PhutilNumber($row['N'])),
$events_col,
$request_col,
$viewer_col,
$context_col,
@ -209,7 +216,7 @@ final class MultimeterSampleController extends MultimeterController {
))
->setColumnClasses(
array(
'n',
null,
null,
null,
null,
@ -241,6 +248,7 @@ final class MultimeterSampleController extends MultimeterController {
'viewer' => pht('By Viewer'),
'request' => pht('By Request'),
'label' => pht('By Label'),
'id' => pht('By ID'),
);
$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;
$uri = $this->getGroupURI($group);
if ($name === null) {
$name = pht('(All)');
}
return phutil_tag(
'a',
array(
'href' => $uri,
'style' => 'font-weight: bold',
),
pht('(All)'));
$name);
}
private function getGroupURI(array $group, $wipe = false) {
@ -318,6 +330,7 @@ final class MultimeterSampleController extends MultimeterController {
'viewer' => 'eventViewerID',
'request' => 'requestKey',
'label' => 'eventLabelID',
'id' => 'id',
);
}