1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php
require("../adei.php");
$slow_threshold = 2;
//$window = array('window' => '86400', 'experiment' => '*-' . time());
$window = array('window' => '172800', 'experiment' => '*-' . time());
$filter = array(
'source' => 'SERVICE(control)'
);
$ivl = new INTERVAL($window);
$opts = array(
'slow_threshold' => $slow_threshold,
're_filters' => array(
'$log["source"]' => '/^SERVICE/',
'$get["target"]' => '/^(set|send)/'
)
);
$res = adeiAnalyzeLogs($ivl, $filter, $opts);
foreach ($res['requests'] as $r) {
if ($r['latency'] < $slow_threshold) continue;
echo $r['time']->format('Y-m-d H:i:s') . " (" . $r['time']->format("U.u") . ") ${r['setup']}/${r['source']}: ${r['service']} - ${r['latency']} | ";
foreach ($r as $key => $value) {
if (preg_match('/^(setup|source|service|latency|time)$/', $key)) continue;
echo "$key: $value ";
}
echo "\n";
}
unset($res['requests']);
print_r($res);
?>
|