Merge pull request #4027 from marek-knappe/fixing-issue-3254-for-2.4

Fixing issue to be able to have mterics work for recommended docker /…
This commit is contained in:
James Brooks
2020-08-01 09:06:48 +01:00
committed by GitHub

View File

@@ -37,8 +37,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"WHERE {$this->getMetricsTable()}.id = :metricId ".
"AND {$this->getMetricPointsTable()}.created_at >= (NOW() - INTERVAL '{$minutes}' MINUTE) ".
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:MI') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:MI') ".
"ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:MI')", [
'metricId' => $metric->id,
]);
@@ -61,8 +61,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"WHERE {$this->getMetricsTable()}.id = :metricId ".
"AND {$this->getMetricPointsTable()}.created_at >= (NOW() - INTERVAL '{$hour}' HOUR) ".
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:00') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00') ".
"ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00')", [
'metricId' => $metric->id,
]);
@@ -80,13 +80,13 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
public function getPointsSinceDay(Metric $metric, $day)
{
$queryType = $this->getQueryType($metric);
$points = DB::select("SELECT DATE({$this->getMetricPointsTable()}.created_at) AS key, {$queryType} ".
$points = DB::select("SELECT to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00') AS key, {$queryType} ".
"FROM {$this->getMetricsTable()} INNER JOIN {$this->getMetricPointsTable()} ON {$this->getMetricsTable()}.id = {$this->getMetricPointsTable()}.metric_id ".
"WHERE {$this->getMetricsTable()}.id = :metricId ".
"AND {$this->getMetricPointsTable()}.created_at >= (DATE(NOW()) - INTERVAL '{$day}' DAY) ".
"AND {$this->getMetricPointsTable()}.created_at <= DATE(NOW()) ".
"GROUP BY DATE({$this->getMetricPointsTable()}.created_at) ".
"ORDER BY DATE({$this->getMetricPointsTable()}.created_at)", [
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00')".
"ORDER BY to_char({$this->getMetricPointsTable()}.created_at, 'YYYY-MM-DD HH24:00')", [
'metricId' => $metric->id,
]);