diff --git a/composer.json b/composer.json index 81b4a3bc..cdabd44a 100644 --- a/composer.json +++ b/composer.json @@ -12,17 +12,17 @@ ], "require": { "php": ">=8.4", - "cakephp/authentication": "^3.3.2", + "cakephp/authentication": "^3.3.3", "cakephp/cakephp": "^5.2.9", "cakephp/migrations": "^4.8.2", "cakephp/plugin-installer": "^2.0.1", "lcobucci/jwt": "^5.6.0", "paragonie/csp-builder": "^3.0.2", - "sentry/sentry": "^4.17.0", + "sentry/sentry": "dev-metrics as 4.18.1", "sentry/sentry-agent": "^0.1.1" }, "require-dev": { - "cakephp/bake": "^3.5.0", + "cakephp/bake": "^3.5.1", "cakephp/cakephp-codesniffer": "^5.3.0", "phpstan/phpstan": "^1.12.32", "phpunit/phpunit": "^10.5.54" diff --git a/composer.lock b/composer.lock index a4539e94..6be4220e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f95592502c7dfd8e6088b0eea278fc1a", + "content-hash": "c955b2d36a34b8843a27be81f0e5a9b5", "packages": [ { "name": "cakephp/authentication", - "version": "3.3.2", + "version": "3.3.3", "source": { "type": "git", "url": "https://github.com/cakephp/authentication.git", - "reference": "76e859261832866884b8b8d78dc14e6d22fb3451" + "reference": "86b48f298df3a566ee63032ea1edf232cd8880fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/authentication/zipball/76e859261832866884b8b8d78dc14e6d22fb3451", - "reference": "76e859261832866884b8b8d78dc14e6d22fb3451", + "url": "https://api.github.com/repos/cakephp/authentication/zipball/86b48f298df3a566ee63032ea1edf232cd8880fe", + "reference": "86b48f298df3a566ee63032ea1edf232cd8880fe", "shasum": "" }, "require": { @@ -33,7 +33,7 @@ "cakephp/cakephp": "^5.1.0", "cakephp/cakephp-codesniffer": "^5.0", "firebase/php-jwt": "^6.2", - "phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.0.9" + "phpunit/phpunit": "^10.5.32 || ^11.3.3 || ^12.0.9" }, "suggest": { "cakephp/cakephp": "Install full core to use \"CookieAuthenticator\".", @@ -72,7 +72,7 @@ "issues": "https://github.com/cakephp/authentication/issues", "source": "https://github.com/cakephp/authentication" }, - "time": "2025-07-30T20:38:32+00:00" + "time": "2025-11-06T02:08:04+00:00" }, { "name": "cakephp/cakephp", @@ -197,16 +197,16 @@ }, { "name": "cakephp/chronos", - "version": "3.2.0", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/cakephp/chronos.git", - "reference": "6c820947bc1372a250288ab164ec1b3bb7afab39" + "reference": "1e417fdd4a3c6602b6c4634cf54aa9b065127fa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/chronos/zipball/6c820947bc1372a250288ab164ec1b3bb7afab39", - "reference": "6c820947bc1372a250288ab164ec1b3bb7afab39", + "url": "https://api.github.com/repos/cakephp/chronos/zipball/1e417fdd4a3c6602b6c4634cf54aa9b065127fa2", + "reference": "1e417fdd4a3c6602b6c4634cf54aa9b065127fa2", "shasum": "" }, "require": { @@ -218,7 +218,7 @@ }, "require-dev": { "cakephp/cakephp-codesniffer": "^5.0", - "phpunit/phpunit": "^10.1.0 || ^11.1.3" + "phpunit/phpunit": "^10.5.58 || ^11.1.3" }, "type": "library", "autoload": { @@ -252,7 +252,7 @@ "issues": "https://github.com/cakephp/chronos/issues", "source": "https://github.com/cakephp/chronos" }, - "time": "2025-06-28T11:35:59+00:00" + "time": "2025-10-30T13:08:23+00:00" }, { "name": "cakephp/migrations", @@ -367,16 +367,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.5.8", + "version": "1.5.9", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "719026bb30813accb68271fee7e39552a58e9f65" + "reference": "1905981ee626e6f852448b7aaa978f8666c5bc54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/719026bb30813accb68271fee7e39552a58e9f65", - "reference": "719026bb30813accb68271fee7e39552a58e9f65", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/1905981ee626e6f852448b7aaa978f8666c5bc54", + "reference": "1905981ee626e6f852448b7aaa978f8666c5bc54", "shasum": "" }, "require": { @@ -423,7 +423,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.5.8" + "source": "https://github.com/composer/ca-bundle/tree/1.5.9" }, "funding": [ { @@ -435,7 +435,7 @@ "type": "github" } ], - "time": "2025-08-20T18:49:47+00:00" + "time": "2025-11-06T11:46:17+00:00" }, { "name": "guzzlehttp/psr7", @@ -1850,16 +1850,16 @@ }, { "name": "sentry/sentry", - "version": "4.17.0", + "version": "dev-metrics", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "62927369a572efc27ddbd89e466e17788329224b" + "reference": "30db6b2b3dd5727c18b08b67dc8c3b6f9882f145" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/62927369a572efc27ddbd89e466e17788329224b", - "reference": "62927369a572efc27ddbd89e466e17788329224b", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/30db6b2b3dd5727c18b08b67dc8c3b6f9882f145", + "reference": "30db6b2b3dd5727c18b08b67dc8c3b6f9882f145", "shasum": "" }, "require": { @@ -1870,7 +1870,7 @@ "jean85/pretty-package-versions": "^1.5|^2.0.4", "php": "^7.2|^8.0", "psr/log": "^1.0|^2.0|^3.0", - "symfony/options-resolver": "^4.4.30|^5.0.11|^6.0|^7.0" + "symfony/options-resolver": "^4.4.30|^5.0.11|^6.0|^7.0|^8.0" }, "conflict": { "raven/raven": "*" @@ -1922,7 +1922,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/4.17.0" + "source": "https://github.com/getsentry/sentry-php/tree/metrics" }, "funding": [ { @@ -1934,7 +1934,7 @@ "type": "custom" } ], - "time": "2025-10-20T12:57:02+00:00" + "time": "2025-11-20T14:22:20+00:00" }, { "name": "sentry/sentry-agent", @@ -2025,16 +2025,16 @@ }, { "name": "symfony/config", - "version": "v7.3.4", + "version": "v7.3.6", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "8a09223170046d2cfda3d2e11af01df2c641e961" + "reference": "9d18eba95655a3152ae4c1d53c6cc34eb4d4a0b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/8a09223170046d2cfda3d2e11af01df2c641e961", - "reference": "8a09223170046d2cfda3d2e11af01df2c641e961", + "url": "https://api.github.com/repos/symfony/config/zipball/9d18eba95655a3152ae4c1d53c6cc34eb4d4a0b7", + "reference": "9d18eba95655a3152ae4c1d53c6cc34eb4d4a0b7", "shasum": "" }, "require": { @@ -2080,7 +2080,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v7.3.4" + "source": "https://github.com/symfony/config/tree/v7.3.6" }, "funding": [ { @@ -2100,20 +2100,20 @@ "type": "tidelift" } ], - "time": "2025-09-22T12:46:16+00:00" + "time": "2025-11-02T08:04:43+00:00" }, { "name": "symfony/console", - "version": "v7.3.4", + "version": "v7.3.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2b9c5fafbac0399a20a2e82429e2bd735dcfb7db" + "reference": "c28ad91448f86c5f6d9d2c70f0cf68bf135f252a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2b9c5fafbac0399a20a2e82429e2bd735dcfb7db", - "reference": "2b9c5fafbac0399a20a2e82429e2bd735dcfb7db", + "url": "https://api.github.com/repos/symfony/console/zipball/c28ad91448f86c5f6d9d2c70f0cf68bf135f252a", + "reference": "c28ad91448f86c5f6d9d2c70f0cf68bf135f252a", "shasum": "" }, "require": { @@ -2178,7 +2178,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.3.4" + "source": "https://github.com/symfony/console/tree/v7.3.6" }, "funding": [ { @@ -2198,7 +2198,7 @@ "type": "tidelift" } ], - "time": "2025-09-22T15:31:00+00:00" + "time": "2025-11-04T01:21:42+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2269,16 +2269,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.3.2", + "version": "v7.3.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd" + "reference": "e9bcfd7837928ab656276fe00464092cc9e1826a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/edcbb768a186b5c3f25d0643159a787d3e63b7fd", - "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e9bcfd7837928ab656276fe00464092cc9e1826a", + "reference": "e9bcfd7837928ab656276fe00464092cc9e1826a", "shasum": "" }, "require": { @@ -2315,7 +2315,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.3.2" + "source": "https://github.com/symfony/filesystem/tree/v7.3.6" }, "funding": [ { @@ -2335,7 +2335,7 @@ "type": "tidelift" } ], - "time": "2025-07-07T08:17:47+00:00" + "time": "2025-11-05T09:52:27+00:00" }, { "name": "symfony/options-resolver", @@ -2745,16 +2745,16 @@ }, { "name": "symfony/service-contracts", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", - "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", "shasum": "" }, "require": { @@ -2808,7 +2808,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" }, "funding": [ { @@ -2819,12 +2819,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-04-25T09:37:31+00:00" + "time": "2025-07-15T11:30:57+00:00" }, { "name": "symfony/string", @@ -2969,22 +2973,22 @@ }, { "name": "cakephp/bake", - "version": "3.5.0", + "version": "3.5.1", "source": { "type": "git", "url": "https://github.com/cakephp/bake.git", - "reference": "ee9ecbe789c06428632dc14b47b6995949ace8b6" + "reference": "f6dc5f8578430f3540faa0474866bb494f7d92e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/bake/zipball/ee9ecbe789c06428632dc14b47b6995949ace8b6", - "reference": "ee9ecbe789c06428632dc14b47b6995949ace8b6", + "url": "https://api.github.com/repos/cakephp/bake/zipball/f6dc5f8578430f3540faa0474866bb494f7d92e1", + "reference": "f6dc5f8578430f3540faa0474866bb494f7d92e1", "shasum": "" }, "require": { "brick/varexporter": "^0.6.0", "cakephp/cakephp": "^5.1", - "cakephp/twig-view": "^2.0.0", + "cakephp/twig-view": "^2.0.2", "nikic/php-parser": "^5.0.0", "php": ">=8.1" }, @@ -3022,7 +3026,7 @@ "issues": "https://github.com/cakephp/bake/issues", "source": "https://github.com/cakephp/bake" }, - "time": "2025-10-05T16:52:58+00:00" + "time": "2025-10-22T13:48:10+00:00" }, { "name": "cakephp/cakephp-codesniffer", @@ -3141,29 +3145,29 @@ }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v1.1.2", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/composer-installer.git", - "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1" + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", - "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1", + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1", "shasum": "" }, "require": { "composer-plugin-api": "^2.2", "php": ">=5.4", - "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + "squizlabs/php_codesniffer": "^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "^2.2", "ext-json": "*", "ext-zip": "*", "php-parallel-lint/php-parallel-lint": "^1.4.0", - "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev", "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", @@ -3233,7 +3237,7 @@ "type": "thanks_dev" } ], - "time": "2025-07-17T20:45:56+00:00" + "time": "2025-11-11T04:32:07+00:00" }, { "name": "jasny/twig-extensions", @@ -3363,16 +3367,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.6.1", + "version": "v5.6.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2" + "reference": "3a454ca033b9e06b63282ce19562e892747449bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb", + "reference": "3a454ca033b9e06b63282ce19562e892747449bb", "shasum": "" }, "require": { @@ -3415,9 +3419,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.2" }, - "time": "2025-08-13T20:13:15+00:00" + "time": "2025-10-21T19:32:17+00:00" }, { "name": "phar-io/manifest", @@ -5087,16 +5091,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "4.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "06113cfdaf117fc2165f9cd040bd0f17fcd5242d" + "reference": "0525c73950de35ded110cffafb9892946d7771b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/06113cfdaf117fc2165f9cd040bd0f17fcd5242d", - "reference": "06113cfdaf117fc2165f9cd040bd0f17fcd5242d", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0525c73950de35ded110cffafb9892946d7771b5", + "reference": "0525c73950de35ded110cffafb9892946d7771b5", "shasum": "" }, "require": { @@ -5162,20 +5166,20 @@ "type": "thanks_dev" } ], - "time": "2025-09-15T11:28:58+00:00" + "time": "2025-11-10T16:43:36+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.3", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", "shasum": "" }, "require": { @@ -5204,7 +5208,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" }, "funding": [ { @@ -5212,20 +5216,20 @@ "type": "github" } ], - "time": "2024-03-03T12:36:25+00:00" + "time": "2025-11-17T20:03:58+00:00" }, { "name": "twig/markdown-extra", - "version": "v3.21.0", + "version": "v3.22.0", "source": { "type": "git", "url": "https://github.com/twigphp/markdown-extra.git", - "reference": "f4616e1dd375209dacf6026f846e6b537d036ce4" + "reference": "fb6f952082e3a7d62a75c8be2c8c47242d3925fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/f4616e1dd375209dacf6026f846e6b537d036ce4", - "reference": "f4616e1dd375209dacf6026f846e6b537d036ce4", + "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/fb6f952082e3a7d62a75c8be2c8c47242d3925fb", + "reference": "fb6f952082e3a7d62a75c8be2c8c47242d3925fb", "shasum": "" }, "require": { @@ -5235,7 +5239,7 @@ }, "require-dev": { "erusev/parsedown": "dev-master as 1.x-dev", - "league/commonmark": "^1.0|^2.0", + "league/commonmark": "^2.7", "league/html-to-markdown": "^4.8|^5.0", "michelf/php-markdown": "^1.8|^2.0", "symfony/phpunit-bridge": "^6.4|^7.0" @@ -5272,7 +5276,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/markdown-extra/tree/v3.21.0" + "source": "https://github.com/twigphp/markdown-extra/tree/v3.22.0" }, "funding": [ { @@ -5284,20 +5288,20 @@ "type": "tidelift" } ], - "time": "2025-01-31T20:45:36+00:00" + "time": "2025-09-15T05:57:37+00:00" }, { "name": "twig/twig", - "version": "v3.21.1", + "version": "v3.22.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "285123877d4dd97dd7c11842ac5fb7e86e60d81d" + "reference": "4509984193026de413baf4ba80f68590a7f2c51d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/285123877d4dd97dd7c11842ac5fb7e86e60d81d", - "reference": "285123877d4dd97dd7c11842ac5fb7e86e60d81d", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/4509984193026de413baf4ba80f68590a7f2c51d", + "reference": "4509984193026de413baf4ba80f68590a7f2c51d", "shasum": "" }, "require": { @@ -5351,7 +5355,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.21.1" + "source": "https://github.com/twigphp/Twig/tree/v3.22.0" }, "funding": [ { @@ -5363,12 +5367,21 @@ "type": "tidelift" } ], - "time": "2025-05-03T07:21:55+00:00" + "time": "2025-10-29T15:56:47+00:00" + } + ], + "aliases": [ + { + "package": "sentry/sentry", + "version": "dev-metrics", + "alias": "4.18.1", + "alias_normalized": "4.18.1.0" } ], - "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "sentry/sentry": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Controller/EventsController.php b/src/Controller/EventsController.php index aa06bf7c..459bded9 100644 --- a/src/Controller/EventsController.php +++ b/src/Controller/EventsController.php @@ -7,6 +7,7 @@ use Cake\Controller\Controller; use Cake\Http\Response; use Sentry\SentrySdk; +use function Sentry\metrics; class EventsController extends Controller { @@ -38,6 +39,34 @@ public function index(): Response 'gibpotato.potatoes.event_size' => mb_strlen(serialize($this->request->getData()), '8bit'), 'gibpotato.event_type' => $event->type, ]); + metrics()->distribution( + 'gibpotato.potatoes.event_processing_time', + (float)microtime(true) - $startTimestamp, + [ + 'gibpotato.event_type' => $event->type, + ], + ); + metrics()->gauge( + 'gibpotato.potatoes.event_processing_time', + (float)microtime(true) - $startTimestamp, + [ + 'gibpotato.event_type' => $event->type, + ], + ); + metrics()->distribution( + 'gibpotato.potatoes.event_size', + (float)mb_strlen(serialize($this->request->getData()), '8bit'), + [ + 'gibpotato.event_type' => $event->type, + ], + ); + metrics()->gauge( + 'gibpotato.potatoes.event_size', + (float)mb_strlen(serialize($this->request->getData()), '8bit'), + [ + 'gibpotato.event_type' => $event->type, + ], + ); } return $this->response diff --git a/src/Middleware/SentryMiddleware.php b/src/Middleware/SentryMiddleware.php index 1593936e..a53fe699 100644 --- a/src/Middleware/SentryMiddleware.php +++ b/src/Middleware/SentryMiddleware.php @@ -17,6 +17,7 @@ use Sentry\Tracing\TransactionSource; use function microtime; use function Sentry\logger; +use function Sentry\metrics; use function Sentry\startTransaction; /** @@ -77,6 +78,11 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface ->setData([ 'gibpotato.gcp.mem_peak_usage' => memory_get_peak_usage(false), ]); + + metrics()->distribution( + 'gcp.mem_peak_usage', + (float)memory_get_peak_usage(false), + ); } EventManager::instance()->on( @@ -84,6 +90,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface function (Event $event) use ($transaction): void { $transaction->finish(); logger()->flush(); + metrics()->flush(); }, ); diff --git a/src/Service/AwardService.php b/src/Service/AwardService.php index 3c8e91ee..030c1423 100644 --- a/src/Service/AwardService.php +++ b/src/Service/AwardService.php @@ -9,6 +9,7 @@ use Cake\ORM\Locator\LocatorAwareTrait; use Sentry\SentrySdk; use function Sentry\logger; +use function Sentry\metrics; class AwardService { @@ -69,6 +70,13 @@ private function gibToUser( 'gibpotato.event_type' => $event->type, ]); } + metrics()->count( + 'gibpotato.potatoes.given_out', + (float)$event->amount, + [ + 'gibpotato.event_type' => $event->type, + ], + ); logger()->info( message: '"%s" gave "%s" %s 🥔', diff --git a/src/Service/QuickWinService.php b/src/Service/QuickWinService.php index 4aed9301..30d844dc 100644 --- a/src/Service/QuickWinService.php +++ b/src/Service/QuickWinService.php @@ -8,6 +8,7 @@ use App\Model\Entity\User; use Cake\ORM\Locator\LocatorAwareTrait; use Sentry\SentrySdk; +use function Sentry\metrics; class QuickWinService { @@ -46,6 +47,11 @@ public function store( $span->setData([ 'gibpotato.message.quick_win' => 1, ]); + + metrics()->count( + 'gibpotato.message.quick_win', + 1, + ); } return true;