{"action":"opened","issue":{"url":"https://api.github.com/repos/omergertel/pyformance/issues/31","repository_url":"https://api.github.com/repos/omergertel/pyformance","labels_url":"https://api.github.com/repos/omergertel/pyformance/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/omergertel/pyformance/issues/31/comments","events_url":"https://api.github.com/repos/omergertel/pyformance/issues/31/events","html_url":"https://github.com/omergertel/pyformance/issues/31","id":192249778,"number":31,"title":"Measuring in Celery task","user":{"login":"michel-cf","id":5745991,"avatar_url":"https://avatars.githubusercontent.com/u/5745991?v=3","gravatar_id":"","url":"https://api.github.com/users/michel-cf","html_url":"https://github.com/michel-cf","followers_url":"https://api.github.com/users/michel-cf/followers","following_url":"https://api.github.com/users/michel-cf/following{/other_user}","gists_url":"https://api.github.com/users/michel-cf/gists{/gist_id}","starred_url":"https://api.github.com/users/michel-cf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michel-cf/subscriptions","organizations_url":"https://api.github.com/users/michel-cf/orgs","repos_url":"https://api.github.com/users/michel-cf/repos","events_url":"https://api.github.com/users/michel-cf/events{/privacy}","received_events_url":"https://api.github.com/users/michel-cf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-29T10:56:28Z","updated_at":"2016-11-29T10:56:28Z","closed_at":null,"body":"For a project of mine, I want to measure inside Celery tasks. But it seems that measured data from the Celery workers does not get reported. (It actually does get printed if I trigger that from within the worker)\r\n\r\nA minimal example:\r\ncelerypyformance.py\r\n```Python\r\nfrom pyformance import MetricsRegistry\r\nfrom pyformance.reporters import ConsoleReporter\r\n\r\nfrom celery import Celery\r\n\r\napp = Celery('celerypyformance', backend='redis://localhost', broker='redis://localhost')\r\n\r\nregistry = MetricsRegistry()\r\nreporter = ConsoleReporter(registry, reporting_interval=2)\r\nreporter.start()\r\n\r\nregistry.counter('started').inc()\r\n\r\n\r\n@app.task\r\ndef task(argument):\r\n    registry.counter('task.%s' % argument).inc()\r\n    print('task.%s' % argument)\r\n```\r\n\r\ntest.py\r\n```Python\r\nfrom celerypyformance import task\r\n\r\nif __name__ == '__main__':\r\n    task.delay(\"delayed\")\r\n```\r\n\r\nIt keeps printing only the start action, never the counter from within the task:\r\n```\r\n== 2016-11-29 10:49:20 ===================================\r\nstarted:\r\n               count = 1\r\n\r\n[2016-11-29 11:49:21,986: WARNING/Worker-3] task.delayed\r\n== 2016-11-29 10:49:22 ===================================\r\nstarted:\r\n               count = 1\r\n```\r\n\r\nTo run:\r\nInstall Celery using pip, install redis. Start the redis server.\r\nRun `celery -A celerypyformance worker` and leave this running while executing the next command.\r\nExecute `python test.py` to execute the celery task.\r\n\r\nIs there something I've forgotten or is there a small fix that can resolve this issue?\r\nThanks in advance"}}
{"actor":{"display_login":"michel-cf"}}