Commit 1ddfab7e authored by Mark Harding's avatar Mark Harding

(feat): analytics graph job should catch errors and not fail for all

parent 01d29bd9
No related merge requests found
Pipeline #67356107 passed with stages
in 6 minutes and 28 seconds
......@@ -85,6 +85,7 @@ class Analytics extends Cli\Controller implements Interfaces\CliControllerInterf
}
public function sync_graphs()
{
error_reporting(E_ALL);
ini_set('display_errors', 1);
......@@ -120,11 +121,14 @@ class Analytics extends Cli\Controller implements Interfaces\CliControllerInterf
foreach ($aggregates as $aggregate) {
$this->out("Syncing {$aggregate}");
$manager->sync([
'aggregate' => $aggregate,
'all' => true,
]);
try {
$manager->sync([
'aggregate' => $aggregate,
'all' => true,
]);
} catch (\Exception $e) {
}
}
$this->out('Completed caching site metrics');
......
......@@ -122,15 +122,6 @@ class ActiveUsers implements AggregateInterface
$query = [
'index' => $this->index,
'size' => 0,
"stored_fields" => [
"*"
],
"docvalue_fields" => [
(object) [
"field" => "@timestamp",
"format" => "date_time"
]
],
'body' => [
'query' => [
'bool' => [
......@@ -226,15 +217,6 @@ class ActiveUsers implements AggregateInterface
$query = [
'index' => $this->index,
'size' => 0,
"stored_fields" => [
"*"
],
"docvalue_fields" => [
(object) [
"field" => "@timestamp",
"format" => "date_time"
]
],
'body' => [
'query' => [
'bool' => [
......@@ -300,9 +282,6 @@ class ActiveUsers implements AggregateInterface
private function getMonthlyPageviews($from, $to, $user_guid)
{
$must = [
[
"match_all" => (object) []
],
[
"range" => [
"@timestamp" => [
......@@ -324,15 +303,6 @@ class ActiveUsers implements AggregateInterface
$query = [
'index' => $this->index,
'size' => 0,
"stored_fields" => [
"*"
],
"docvalue_fields" => [
(object) [
"field" => "@timestamp",
"format" => "date_time"
]
],
'body' => [
'query' => [
'bool' => [
......@@ -344,7 +314,7 @@ class ActiveUsers implements AggregateInterface
"date_histogram" => [
"field" => "@timestamp",
"interval" => "1M",
"min_doc_count" => 1
//"min_doc_count" => 1
],
"aggs" => [
"mau_logged_in" => [
......@@ -352,7 +322,7 @@ class ActiveUsers implements AggregateInterface
"field" => "user_guid.keyword"
]
],
"mau_unique" => [
"mau_unique" => [
"cardinality" => [
"field" => "cookie_id.keyword"
]
......@@ -386,7 +356,7 @@ class ActiveUsers implements AggregateInterface
$prepared->query($query);
$result = $this->client->request($prepared);
$response = [
[
'name' => 'MAU',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment