From 15522c2cb98128e4c27bef6ae6b3a70f7f843a36 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 May 2021 13:15:36 +0200 Subject: [PATCH 1/7] feat(influxdb): introduce official client SDK --- app/controllers/api/functions.php | 14 ++++----- app/controllers/api/projects.php | 12 ++++---- app/init.php | 11 +++++-- composer.json | 4 +-- composer.lock | 48 ++++++++++++++++++++++++++++++- 5 files changed, 68 insertions(+), 21 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index ff8b7d5bc9..9e1d2d97a7 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -192,7 +192,8 @@ App::get('/v1/functions/:functionId/usage') 'group' => '1d', ], ]; - + + /** @var InfluxDB2\Client $client */ $client = $register->get('influxdb'); $executions = []; @@ -202,13 +203,12 @@ App::get('/v1/functions/:functionId/usage') if ($client) { $start = $period[$range]['start']->format(DateTime::RFC3339); $end = $period[$range]['end']->format(DateTime::RFC3339); - $database = $client->selectDB('telegraf'); + $database = $client->createQueryApi(); // Executions $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - foreach ($points as $point) { + foreach ($result as $point) { $executions[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -217,9 +217,8 @@ App::get('/v1/functions/:functionId/usage') // Failures $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' AND "functionStatus"=\'failed\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - foreach ($points as $point) { + foreach ($result as $point) { $failures[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -228,9 +227,8 @@ App::get('/v1/functions/:functionId/usage') // Compute $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_time" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - foreach ($points as $point) { + foreach ($result as $point) { $compute[] = [ 'value' => round((!empty($point['value'])) ? $point['value'] / 1000 : 0, 2), // minutes 'date' => \strtotime($point['time']), diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 0b9eb64ff0..3a14c94c8c 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -206,6 +206,7 @@ App::get('/v1/projects/:projectId/usage') ], ]; + /** @var InfluxDB2\Client $client */ $client = $register->get('influxdb'); $requests = []; @@ -215,13 +216,12 @@ App::get('/v1/projects/:projectId/usage') if ($client) { $start = $period[$range]['start']->format(DateTime::RFC3339); $end = $period[$range]['end']->format(DateTime::RFC3339); - $database = $client->selectDB('telegraf'); + $database = $client->createQueryApi(); // Requests $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_requests_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - foreach ($points as $point) { + foreach ($result as $point) { $requests[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -230,9 +230,8 @@ App::get('/v1/projects/:projectId/usage') // Network $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_network_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - foreach ($points as $point) { + foreach ($result as $point) { $network[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -241,9 +240,8 @@ App::get('/v1/projects/:projectId/usage') // Functions $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); - $points = $result->getPoints(); - foreach ($points as $point) { + foreach ($result as $point) { $functions[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), diff --git a/app/init.php b/app/init.php index bc5e37d28a..5ec4346884 100644 --- a/app/init.php +++ b/app/init.php @@ -170,7 +170,12 @@ $register->set('influxdb', function () { // Register DB connection return; } - $client = new InfluxDB\Client($host, $port, '', '', false, false, 5); + $client = new InfluxDB2\Client([ + 'url' => "http://{$host}:{$port}", + 'bucket' => 'telegraf/autogen', + 'timeout' => 5, + 'verifySSL' => false + ]); return $client; }); @@ -190,10 +195,10 @@ $register->set('cache', function () { // Register cache connection $pass = App::getEnv('_APP_REDIS_PASS',''); $auth = []; if(!empty($user)) { - $auth["user"] = $user; + $auth['user'] = $user; } if(!empty($pass)) { - $auth["pass"] = $pass; + $auth['pass'] = $pass; } if(!empty($auth)) { $redis->auth($auth); diff --git a/composer.json b/composer.json index 4b68a5f1c7..920d4ccd56 100644 --- a/composer.json +++ b/composer.json @@ -55,11 +55,11 @@ "resque/php-resque": "1.3.6", "matomo/device-detector": "4.2.2", "dragonmantank/cron-expression": "3.1.0", - "influxdb/influxdb-php": "1.15.2", "phpmailer/phpmailer": "6.4.0", "chillerlan/php-qrcode": "4.3.0", "adhocore/jwt": "1.1.2", - "slickdeals/statsd": "3.0.2" + "slickdeals/statsd": "3.0.2", + "influxdata/influxdb-client-php": "^1.12" }, "require-dev": { "appwrite/sdk-generator": "dev-feat-preps-for-0.8", diff --git a/composer.lock b/composer.lock index 8e54ef9bbb..3b8283e4d4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "32ceddda707fb8f625f84eec08dc3871", + "content-hash": "ea8c94c961eb9a64a93d87114fbc74cc", "packages": [ { "name": "adhocore/jwt", @@ -647,6 +647,52 @@ }, "time": "2021-04-26T09:17:50+00:00" }, + { + "name": "influxdata/influxdb-client-php", + "version": "1.12.0", + "source": { + "type": "git", + "url": "https://github.com/influxdata/influxdb-client-php.git", + "reference": "e04f802a4d9c52b5b497077673269e8463fdb6ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/influxdata/influxdb-client-php/zipball/e04f802a4d9c52b5b497077673269e8463fdb6ea", + "reference": "e04f802a4d9c52b5b497077673269e8463fdb6ea", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^6.2|^7.0.1", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.4|^9.1", + "squizlabs/php_codesniffer": "~2.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "InfluxDB2\\": "src/InfluxDB2" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "InfluxDB (v2+) Client Library for PHP", + "homepage": "https://www.github.com/influxdata/influxdb-client-php", + "keywords": [ + "influxdb" + ], + "support": { + "issues": "https://github.com/influxdata/influxdb-client-php/issues", + "source": "https://github.com/influxdata/influxdb-client-php/tree/1.12.0" + }, + "time": "2021-04-01T06:28:57+00:00" + }, { "name": "influxdb/influxdb-php", "version": "1.15.2", From bf8994fa3aabfba8bd37b4b20268408e71c0766a Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 May 2021 13:55:01 +0200 Subject: [PATCH 2/7] Revert "feat(influxdb): introduce official client SDK" This reverts commit 15522c2cb98128e4c27bef6ae6b3a70f7f843a36. --- app/controllers/api/functions.php | 14 +++++---- app/controllers/api/projects.php | 12 ++++---- app/init.php | 11 ++----- composer.json | 4 +-- composer.lock | 48 +------------------------------ 5 files changed, 21 insertions(+), 68 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 9e1d2d97a7..ff8b7d5bc9 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -192,8 +192,7 @@ App::get('/v1/functions/:functionId/usage') 'group' => '1d', ], ]; - - /** @var InfluxDB2\Client $client */ + $client = $register->get('influxdb'); $executions = []; @@ -203,12 +202,13 @@ App::get('/v1/functions/:functionId/usage') if ($client) { $start = $period[$range]['start']->format(DateTime::RFC3339); $end = $period[$range]['end']->format(DateTime::RFC3339); - $database = $client->createQueryApi(); + $database = $client->selectDB('telegraf'); // Executions $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); - foreach ($result as $point) { + foreach ($points as $point) { $executions[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -217,8 +217,9 @@ App::get('/v1/functions/:functionId/usage') // Failures $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' AND "functionStatus"=\'failed\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); - foreach ($result as $point) { + foreach ($points as $point) { $failures[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -227,8 +228,9 @@ App::get('/v1/functions/:functionId/usage') // Compute $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_time" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' AND "functionId"=\''.$function->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); - foreach ($result as $point) { + foreach ($points as $point) { $compute[] = [ 'value' => round((!empty($point['value'])) ? $point['value'] / 1000 : 0, 2), // minutes 'date' => \strtotime($point['time']), diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 3a14c94c8c..0b9eb64ff0 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -206,7 +206,6 @@ App::get('/v1/projects/:projectId/usage') ], ]; - /** @var InfluxDB2\Client $client */ $client = $register->get('influxdb'); $requests = []; @@ -216,12 +215,13 @@ App::get('/v1/projects/:projectId/usage') if ($client) { $start = $period[$range]['start']->format(DateTime::RFC3339); $end = $period[$range]['end']->format(DateTime::RFC3339); - $database = $client->createQueryApi(); + $database = $client->selectDB('telegraf'); // Requests $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_requests_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); - foreach ($result as $point) { + foreach ($points as $point) { $requests[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -230,8 +230,9 @@ App::get('/v1/projects/:projectId/usage') // Network $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_network_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); - foreach ($result as $point) { + foreach ($points as $point) { $network[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), @@ -240,8 +241,9 @@ App::get('/v1/projects/:projectId/usage') // Functions $result = $database->query('SELECT sum(value) AS "value" FROM "appwrite_usage_executions_all" WHERE time > \''.$start.'\' AND time < \''.$end.'\' AND "metric_type"=\'counter\' AND "project"=\''.$project->getId().'\' GROUP BY time('.$period[$range]['group'].') FILL(null)'); + $points = $result->getPoints(); - foreach ($result as $point) { + foreach ($points as $point) { $functions[] = [ 'value' => (!empty($point['value'])) ? $point['value'] : 0, 'date' => \strtotime($point['time']), diff --git a/app/init.php b/app/init.php index 5ec4346884..bc5e37d28a 100644 --- a/app/init.php +++ b/app/init.php @@ -170,12 +170,7 @@ $register->set('influxdb', function () { // Register DB connection return; } - $client = new InfluxDB2\Client([ - 'url' => "http://{$host}:{$port}", - 'bucket' => 'telegraf/autogen', - 'timeout' => 5, - 'verifySSL' => false - ]); + $client = new InfluxDB\Client($host, $port, '', '', false, false, 5); return $client; }); @@ -195,10 +190,10 @@ $register->set('cache', function () { // Register cache connection $pass = App::getEnv('_APP_REDIS_PASS',''); $auth = []; if(!empty($user)) { - $auth['user'] = $user; + $auth["user"] = $user; } if(!empty($pass)) { - $auth['pass'] = $pass; + $auth["pass"] = $pass; } if(!empty($auth)) { $redis->auth($auth); diff --git a/composer.json b/composer.json index 920d4ccd56..4b68a5f1c7 100644 --- a/composer.json +++ b/composer.json @@ -55,11 +55,11 @@ "resque/php-resque": "1.3.6", "matomo/device-detector": "4.2.2", "dragonmantank/cron-expression": "3.1.0", + "influxdb/influxdb-php": "1.15.2", "phpmailer/phpmailer": "6.4.0", "chillerlan/php-qrcode": "4.3.0", "adhocore/jwt": "1.1.2", - "slickdeals/statsd": "3.0.2", - "influxdata/influxdb-client-php": "^1.12" + "slickdeals/statsd": "3.0.2" }, "require-dev": { "appwrite/sdk-generator": "dev-feat-preps-for-0.8", diff --git a/composer.lock b/composer.lock index 3b8283e4d4..8e54ef9bbb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ea8c94c961eb9a64a93d87114fbc74cc", + "content-hash": "32ceddda707fb8f625f84eec08dc3871", "packages": [ { "name": "adhocore/jwt", @@ -647,52 +647,6 @@ }, "time": "2021-04-26T09:17:50+00:00" }, - { - "name": "influxdata/influxdb-client-php", - "version": "1.12.0", - "source": { - "type": "git", - "url": "https://github.com/influxdata/influxdb-client-php.git", - "reference": "e04f802a4d9c52b5b497077673269e8463fdb6ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/influxdata/influxdb-client-php/zipball/e04f802a4d9c52b5b497077673269e8463fdb6ea", - "reference": "e04f802a4d9c52b5b497077673269e8463fdb6ea", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/guzzle": "^6.2|^7.0.1", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.4|^9.1", - "squizlabs/php_codesniffer": "~2.6" - }, - "type": "library", - "autoload": { - "psr-4": { - "InfluxDB2\\": "src/InfluxDB2" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "InfluxDB (v2+) Client Library for PHP", - "homepage": "https://www.github.com/influxdata/influxdb-client-php", - "keywords": [ - "influxdb" - ], - "support": { - "issues": "https://github.com/influxdata/influxdb-client-php/issues", - "source": "https://github.com/influxdata/influxdb-client-php/tree/1.12.0" - }, - "time": "2021-04-01T06:28:57+00:00" - }, { "name": "influxdb/influxdb-php", "version": "1.15.2", From a46638544f8f00cc50018bfd8892510897896907 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 May 2021 14:15:29 +0200 Subject: [PATCH 3/7] debug influx --- app/init.php | 2 +- composer.json | 6 ++++- composer.lock | 73 +++++++++++++++++++++++++++------------------------ 3 files changed, 44 insertions(+), 37 deletions(-) diff --git a/app/init.php b/app/init.php index bc5e37d28a..3c3bbe1a56 100644 --- a/app/init.php +++ b/app/init.php @@ -170,7 +170,7 @@ $register->set('influxdb', function () { // Register DB connection return; } - $client = new InfluxDB\Client($host, $port, '', '', false, false, 5); + $client = new InfluxDB\Client(host: $host, port: $port, timeout: 5); return $client; }); diff --git a/composer.json b/composer.json index 4b68a5f1c7..00ff95790d 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "resque/php-resque": "1.3.6", "matomo/device-detector": "4.2.2", "dragonmantank/cron-expression": "3.1.0", - "influxdb/influxdb-php": "1.15.2", + "influxdb/influxdb-php": "dev-fix-php-8", "phpmailer/phpmailer": "6.4.0", "chillerlan/php-qrcode": "4.3.0", "adhocore/jwt": "1.1.2", @@ -71,6 +71,10 @@ { "type": "git", "url": "https://github.com/appwrite/sdk-generator" + }, + { + "type": "git", + "url": "https://github.com/torstendittmann/influxdb-php" } ], "provide": { diff --git a/composer.lock b/composer.lock index 8e54ef9bbb..9042b9572f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "32ceddda707fb8f625f84eec08dc3871", + "content-hash": "e1895c2ac913b340a77d06030122f42e", "packages": [ { "name": "adhocore/jwt", @@ -649,17 +649,11 @@ }, { "name": "influxdb/influxdb-php", - "version": "1.15.2", + "version": "dev-fix-php-8", "source": { "type": "git", - "url": "https://github.com/influxdata/influxdb-php.git", - "reference": "d6e59f4f04ab9107574fda69c2cbe36671253d03" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/influxdata/influxdb-php/zipball/d6e59f4f04ab9107574fda69c2cbe36671253d03", - "reference": "d6e59f4f04ab9107574fda69c2cbe36671253d03", - "shasum": "" + "url": "https://github.com/torstendittmann/influxdb-php", + "reference": "a784e08b0bf1658b11ff14c86942c9ba7a77709f" }, "require": { "guzzlehttp/guzzle": "^6.0|^7.0", @@ -679,7 +673,19 @@ "InfluxDB\\": "src/InfluxDB" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "InfluxDB\\Test\\": "tests" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpunit" + ], + "test-ci": [ + "vendor/bin/phpunit -v --coverage-clover=clover.xml" + ] + }, "license": [ "MIT" ], @@ -707,11 +713,7 @@ "influxdb library", "time series" ], - "support": { - "issues": "https://github.com/influxdata/influxdb-php/issues", - "source": "https://github.com/influxdata/influxdb-php/tree/1.15.2" - }, - "time": "2020-12-26T17:45:17+00:00" + "time": "2021-05-04T12:12:20+00:00" }, { "name": "matomo/device-detector", @@ -1015,16 +1017,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -1048,7 +1050,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1059,9 +1061,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "ralouphie/getallheaders", @@ -3043,16 +3045,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.10.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f", + "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f", "shasum": "" }, "require": { @@ -3093,9 +3095,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.5" }, - "time": "2020-12-20T10:01:03+00:00" + "time": "2021-05-03T19:11:20+00:00" }, { "name": "openlss/lib-array2xml", @@ -4973,16 +4975,16 @@ }, { "name": "symfony/console", - "version": "v5.2.6", + "version": "v5.2.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d" + "reference": "90374b8ed059325b49a29b55b3f8bb4062c87629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/35f039df40a3b335ebf310f244cb242b3a83ac8d", - "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d", + "url": "https://api.github.com/repos/symfony/console/zipball/90374b8ed059325b49a29b55b3f8bb4062c87629", + "reference": "90374b8ed059325b49a29b55b3f8bb4062c87629", "shasum": "" }, "require": { @@ -5050,7 +5052,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.6" + "source": "https://github.com/symfony/console/tree/v5.2.7" }, "funding": [ { @@ -5066,7 +5068,7 @@ "type": "tidelift" } ], - "time": "2021-03-28T09:42:18+00:00" + "time": "2021-04-19T14:07:32+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -5925,6 +5927,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "influxdb/influxdb-php": 20, "appwrite/sdk-generator": 20 }, "prefer-stable": false, From 3ab5fefb79847cca3ada821a821e328e7e4b3d70 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 May 2021 14:32:20 +0200 Subject: [PATCH 4/7] fix(influx): use curl as driver --- app/init.php | 3 ++- composer.json | 6 +----- composer.lock | 35 ++++++++++++++++------------------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/app/init.php b/app/init.php index 3c3bbe1a56..63910c860a 100644 --- a/app/init.php +++ b/app/init.php @@ -169,8 +169,9 @@ $register->set('influxdb', function () { // Register DB connection if (empty($host) || empty($port)) { return; } - + $driver = new InfluxDB\Driver\Curl(dsn: "http://{$host}:{$port}"); $client = new InfluxDB\Client(host: $host, port: $port, timeout: 5); + $client->setDriver($driver); return $client; }); diff --git a/composer.json b/composer.json index 00ff95790d..4b68a5f1c7 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "resque/php-resque": "1.3.6", "matomo/device-detector": "4.2.2", "dragonmantank/cron-expression": "3.1.0", - "influxdb/influxdb-php": "dev-fix-php-8", + "influxdb/influxdb-php": "1.15.2", "phpmailer/phpmailer": "6.4.0", "chillerlan/php-qrcode": "4.3.0", "adhocore/jwt": "1.1.2", @@ -71,10 +71,6 @@ { "type": "git", "url": "https://github.com/appwrite/sdk-generator" - }, - { - "type": "git", - "url": "https://github.com/torstendittmann/influxdb-php" } ], "provide": { diff --git a/composer.lock b/composer.lock index 9042b9572f..42129feac8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e1895c2ac913b340a77d06030122f42e", + "content-hash": "32ceddda707fb8f625f84eec08dc3871", "packages": [ { "name": "adhocore/jwt", @@ -649,11 +649,17 @@ }, { "name": "influxdb/influxdb-php", - "version": "dev-fix-php-8", + "version": "1.15.2", "source": { "type": "git", - "url": "https://github.com/torstendittmann/influxdb-php", - "reference": "a784e08b0bf1658b11ff14c86942c9ba7a77709f" + "url": "https://github.com/influxdata/influxdb-php.git", + "reference": "d6e59f4f04ab9107574fda69c2cbe36671253d03" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/influxdata/influxdb-php/zipball/d6e59f4f04ab9107574fda69c2cbe36671253d03", + "reference": "d6e59f4f04ab9107574fda69c2cbe36671253d03", + "shasum": "" }, "require": { "guzzlehttp/guzzle": "^6.0|^7.0", @@ -673,19 +679,7 @@ "InfluxDB\\": "src/InfluxDB" } }, - "autoload-dev": { - "psr-4": { - "InfluxDB\\Test\\": "tests" - } - }, - "scripts": { - "test": [ - "vendor/bin/phpunit" - ], - "test-ci": [ - "vendor/bin/phpunit -v --coverage-clover=clover.xml" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -713,7 +707,11 @@ "influxdb library", "time series" ], - "time": "2021-05-04T12:12:20+00:00" + "support": { + "issues": "https://github.com/influxdata/influxdb-php/issues", + "source": "https://github.com/influxdata/influxdb-php/tree/1.15.2" + }, + "time": "2020-12-26T17:45:17+00:00" }, { "name": "matomo/device-detector", @@ -5927,7 +5925,6 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "influxdb/influxdb-php": 20, "appwrite/sdk-generator": 20 }, "prefer-stable": false, From cee42bfd57b993d3245c3c25086392e4dd99f829 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 May 2021 15:15:46 +0200 Subject: [PATCH 5/7] tests(project): remove timeout from usage call --- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 311c533c3a..07042f8b78 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -149,8 +149,6 @@ class ProjectsConsoleClientTest extends Scope { $id = $data['projectId'] ?? ''; - sleep(30); - /** * Test for SUCCESS */ From d5beb05206aa07bef2d583462872aee0a26e9cf8 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 May 2021 17:24:33 +0200 Subject: [PATCH 6/7] tests(project): change test order for influxdb to have a database --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 6be2d27d7b..f0a2813f5a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -19,12 +19,12 @@ ./tests/e2e/Client.php ./tests/e2e/General ./tests/e2e/Scopes - ./tests/e2e/Services/Projects ./tests/e2e/Services/Account ./tests/e2e/Services/Avatars ./tests/e2e/Services/Database ./tests/e2e/Services/Health ./tests/e2e/Services/Locale + ./tests/e2e/Services/Projects ./tests/e2e/Services/Storage ./tests/e2e/Services/Teams ./tests/e2e/Services/Users From 9c2b066e9ec9126d836f0eff4529b8755c2b906a Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 May 2021 17:42:29 +0200 Subject: [PATCH 7/7] test(travis): use new runtimes env variable --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2265373c23..af63bd6030 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ before_install: - chmod -R u+x ./.travis-ci - export COMPOSE_INTERACTIVE_NO_CLI=1 # Only pass a single runtime for CI stability -- echo "_APP_FUNCTIONS_ENVS=php-8.0" >> .env +- echo "_APP_FUNCTIONS_RUNTIMES=php-8.0" >> .env install: - docker-compose up -d