{"id":20533528,"url":"https://github.com/zoonru/pyrospy","last_synced_at":"2025-04-14T06:44:38.487Z","repository":{"id":98762551,"uuid":"485844385","full_name":"zoonru/pyrospy","owner":"zoonru","description":"Adapter from phpspy to pyroscope","archived":false,"fork":false,"pushed_at":"2025-03-14T15:20:22.000Z","size":39,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T20:24:05.819Z","etag":null,"topics":["adapter","phpspy","profiler","pyroscope"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zoonru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-26T15:28:15.000Z","updated_at":"2025-03-14T15:18:56.000Z","dependencies_parsed_at":"2024-07-24T21:49:22.798Z","dependency_job_id":"15dfb39e-3577-43b7-a7b3-f84f95d5942d","html_url":"https://github.com/zoonru/pyrospy","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoonru%2Fpyrospy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoonru%2Fpyrospy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoonru%2Fpyrospy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoonru%2Fpyrospy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoonru","download_url":"https://codeload.github.com/zoonru/pyrospy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837264,"owners_count":21169373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter","phpspy","profiler","pyroscope"],"created_at":"2024-11-16T00:22:01.972Z","updated_at":"2025-04-14T06:44:38.460Z","avatar_url":"https://github.com/zoonru.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyroSpy\nAdapter from [phpspy](https://github.com/adsr/phpspy) to [pyroscope.io](https://pyroscope.io)\n\n## About Us\n\u003ctable width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003ca href=\"https://company.zoon.ru\"\u003e\n        \u003cimg src=\"https://company.zoon.ru/images/logo.svg\" width=\"140\" alt=\"zoon logo\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n        \u003cb\u003e\u003ca href=\"https://zoon.ru/\" target=\"_blank\"\u003eZoon\u003c/a\u003e\u003c/b\u003e - it's international service, that helps local businesses grow.\n        \u003cul\u003e\n            \u003cli\u003eWe tell the audience about the services and products of companies\u003c/li\u003e\n            \u003cli\u003eWe promote on dozens of sites: in the catalog on zoon.ru, on partner sites, on Yandex and Google maps\u003c/li\u003e\n            \u003cli\u003eWe help business owners manage marketing from a single personal account\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Phpspy requirements\n- `apt install binutils` for Ubuntu/Debian\n- To use in docker container it must be `privileged` or with capability `SYS_PTRACE`\n\n## Parameters:\n```text\nUsage:\n  php pyrospy.php run [options]\n\nOptions:\n  -s, --pyroscope=STRING     Url of the pyroscope server. \n                             Example: https://your-pyroscope-sever.com\n                             \n  -auth, --pyroscopeAuthToken=STRING     \n                             Pyroscope Auth Token. \n                             Example: psx-BWlqy_dW1Wxg6oBjuCWD28HxGCkB1Jfzt-jjtqHzrkzI\n                             \n  -a, --app=STRING           Name of app. \n                             All samples will be saved under given app name.\n                             Example: app\n                             \n  -r, --rateHz=INT           Sample rate in Hz. \n                             Used to convert number of samples to CPU time \n                             [default: 100]\n                             \n  -i, --interval=INT         Maximum time between requests to pyroscope server \n                             [default: 10]\n                             \n  -b, --batch=INT            Maximum number of traces in request to pyroscope server \n                             [default: 250]\n                             \n  -t, --tags=STRING=STRING   Add tags to samples. Use to filter data inside one app.\n                             Example: host=server1; role=cli \n                             (multiple values allowed)\n                             \n  -p, --plugins=STRING       Load custom class to modify trace and phpspy comments/tags. Can be class or folder with classes.\n                             Example: /zoon/pyrospy/app/Plugins/ClearEmptyTags.php\n                             (multiple values allowed)\n                             \n  -h, --help                 Display help for the given command. \n                             When no command is given display help for the list command\n\n```\n\n## Usage:\n```shell\nphpspy --max-depth=-1 --time-limit-ms=59000 --threads=1024 --rate-hz=4 --buffer-size=65536 -J m -P '-x \"php|php[0-9]\\.[0-9]\" | shuf' 2\u003e error_log.log | php pyrospy.php run --pyroscope=https://pyroscope.yourdomain.com --rateHz=4 --app=testApp --tags=host=server39 --tags=role=cli\n\nphpspy --max-depth=-1 --time-limit-ms=59000 --threads=100 --rate-hz=25 --buffer-size=65536 -J m -P '-x \"php-fpm|php-fpm[0-9]\\.[0-9]\" | shuf' 2\u003e error_log.log | php pyrospy.php run --pyroscope=https://pyroscope.yourdomain.com --rateHz=25 --app=testApp --tags=host=server39 --tags=role=web\n```\n\n## Plugins\n\n1. Create `.php` plugin class. Put it in any place. Make sure it has `namespace Zoon\\PyroSpy\\Plugins;` and classname match filename.\n```php\n\u003c?php\n\nnamespace Zoon\\PyroSpy\\Plugins;\n\nclass MyAwesomePlugin implements PluginInterface {\n\n    public function process(array $tags, array $trace): array {\n        //Modify tags and/or trace\n\n        return [$tags, $trace];\n    }\n}\n```\nMultiple plugins can be provided. Each plugin will get tags and trace from results of the previous.\n\n2. Add `--request-info=QCuP` to phpspy args, to add uri string to tags.\n3. Provide full path to it in pyrospy arguments.\n4. To ignore a trace, return an empty trace.\n\nExample:\n```shell\nphpspy --max-depth=-1 --time-limit-ms=59000 --threads=100 --rate-hz=25 --buffer-size=65536 -J m -P '-x \"php-fpm|php-fpm[0-9]\\.[0-9]\" | shuf' --request-info=QCuP 2\u003e error_log.log | php pyrospy.php run --pyroscope=https://pyroscope.yourdomain.com --rateHz=25 --app=testApp --tags=host=server39 --tags=role=web --plugins=/zoon/pyrospy/app/Plugins/ClearEmptyTags.php\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoonru%2Fpyrospy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoonru%2Fpyrospy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoonru%2Fpyrospy/lists"}