sync with main

This commit is contained in:
shimon 2024-01-02 12:24:57 +02:00
parent 99f1543f1b
commit f14250bf2a
3 changed files with 37 additions and 25 deletions

2
.gitmodules vendored
View file

@ -1,4 +1,4 @@
[submodule "app/console"]
path = app/console
url = https://github.com/appwrite/console
branch = 3.2.16
branch = 3.3.15

26
composer.lock generated
View file

@ -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": "0954f1d596a1b28854685b0671110d0e",
"content-hash": "8b973a84686b69049a4416264a3fb547",
"packages": [
{
"name": "adhocore/jwt",
@ -1350,16 +1350,16 @@
},
{
"name": "utopia-php/framework",
"version": "0.31.0",
"version": "0.31.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/framework.git",
"reference": "207f77378965fca9a9bc3783ea379d3549f86bc0"
"reference": "e50d2d16f4bc31319043f3f6d3dbea36c6fd6b68"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/207f77378965fca9a9bc3783ea379d3549f86bc0",
"reference": "207f77378965fca9a9bc3783ea379d3549f86bc0",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/e50d2d16f4bc31319043f3f6d3dbea36c6fd6b68",
"reference": "e50d2d16f4bc31319043f3f6d3dbea36c6fd6b68",
"shasum": ""
},
"require": {
@ -1389,9 +1389,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/framework/issues",
"source": "https://github.com/utopia-php/framework/tree/0.31.0"
"source": "https://github.com/utopia-php/framework/tree/0.31.1"
},
"time": "2023-08-30T16:10:04+00:00"
"time": "2023-12-08T18:47:29+00:00"
},
{
"name": "utopia-php/image",
@ -2023,16 +2023,16 @@
},
{
"name": "utopia-php/storage",
"version": "0.18.1",
"version": "0.18.3",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/storage.git",
"reference": "983e6dee137012f9f57f126d3c79aab54e4e8824"
"reference": "faa0279519ac14f3501e8b138e0865ad9d12bff6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/983e6dee137012f9f57f126d3c79aab54e4e8824",
"reference": "983e6dee137012f9f57f126d3c79aab54e4e8824",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/faa0279519ac14f3501e8b138e0865ad9d12bff6",
"reference": "faa0279519ac14f3501e8b138e0865ad9d12bff6",
"shasum": ""
},
"require": {
@ -2072,9 +2072,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/storage/issues",
"source": "https://github.com/utopia-php/storage/tree/0.18.1"
"source": "https://github.com/utopia-php/storage/tree/0.18.3"
},
"time": "2023-10-24T14:44:19+00:00"
"time": "2023-12-31T11:45:12+00:00"
},
{
"name": "utopia-php/swoole",

View file

@ -22,17 +22,18 @@ use Utopia\Pools\Group;
class Hamster extends Action
{
private array $metrics = [
'usage_files' => 'files.$all.count.total',
'usage_buckets' => 'buckets.$all.count.total',
'usage_databases' => 'databases.$all.count.total',
'usage_documents' => 'documents.$all.count.total',
'usage_collections' => 'collections.$all.count.total',
'usage_storage' => 'project.$all.storage.size',
'usage_requests' => 'project.$all.network.requests',
'usage_bandwidth' => 'project.$all.network.bandwidth',
'usage_users' => 'users.$all.count.total',
'usage_sessions' => 'sessions.email.requests.create',
'usage_executions' => 'executions.$all.compute.total',
'usage_files' => 'files',
'usage_buckets' => 'buckets',
'usage_databases' => 'databases',
'usage_documents' => 'documents',
'usage_collections' => 'collections',
'usage_storage' => 'files.storage',
'usage_requests' => 'network.requests',
'usage_inbound' => 'network.inbound',
'usage_outbound' => 'network.outbound',
'usage_users' => 'users',
'usage_sessions' => 'sessions',
'usage_executions' => 'executions',
];
protected Mixpanel $mixpanel;
@ -298,6 +299,17 @@ class Hamster extends Action
}
});
/**
* Workaround to combine network.inbound+network.outbound as network.
*/
$statsPerProject["usage_network_infinity"] = $statsPerProject["usage_inbound_infinity"] + $statsPerProject["usage_outbound_infinity"];
$statsPerProject["usage_network_24h"] = $statsPerProject["usage_inbound_24h"] + $statsPerProject["usage_outbound_24h"];
unset($statsPerProject["usage_outbound_24h"]);
unset($statsPerProject["usage_inbound_24h"]);
unset($statsPerProject["usage_outbound_infinity"]);
unset($statsPerProject["usage_inbound_infinity"]);
if (isset($statsPerProject['email'])) {
/** Send data to mixpanel */
$res = $this->mixpanel->createProfile($statsPerProject['email'], '', [