{"action":"created","issue":{"url":"https://api.github.com/repos/dkruchinin/sanic-prometheus/issues/4","repository_url":"https://api.github.com/repos/dkruchinin/sanic-prometheus","labels_url":"https://api.github.com/repos/dkruchinin/sanic-prometheus/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/dkruchinin/sanic-prometheus/issues/4/comments","events_url":"https://api.github.com/repos/dkruchinin/sanic-prometheus/issues/4/events","html_url":"https://github.com/dkruchinin/sanic-prometheus/issues/4","id":280821409,"number":4,"title":"Uncorrect monitoring task finish","user":{"login":"SirEdvin","id":3713151,"avatar_url":"https://avatars0.githubusercontent.com/u/3713151?v=4","gravatar_id":"","url":"https://api.github.com/users/SirEdvin","html_url":"https://github.com/SirEdvin","followers_url":"https://api.github.com/users/SirEdvin/followers","following_url":"https://api.github.com/users/SirEdvin/following{/other_user}","gists_url":"https://api.github.com/users/SirEdvin/gists{/gist_id}","starred_url":"https://api.github.com/users/SirEdvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirEdvin/subscriptions","organizations_url":"https://api.github.com/users/SirEdvin/orgs","repos_url":"https://api.github.com/users/SirEdvin/repos","events_url":"https://api.github.com/users/SirEdvin/events{/privacy}","received_events_url":"https://api.github.com/users/SirEdvin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-10T16:14:15Z","updated_at":"2017-12-11T14:33:42Z","closed_at":null,"author_association":"NONE","body":"Checked on `sanic==0.6.0`.\r\nAfter app finished, monitoring coroutine was forced finished with message.\r\n\r\n```\r\nTask was destroyed but it is pending!\r\ntask: <Task pending coro=<make_periodic_memcollect_task.<locals>.collector() running at /home/siredvin/.pyenv/pastereport/lib/python3.6/site-packages/sanic_prometheus/metrics.py:51> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fcb0b71c6d8>()]>>\r\n```\r\n\r\nI guess, in monitoring method should be added something like:\r\n\r\n```\r\n@app.listener('after_server_stop')\r\ndef after_stop(app, loop):\r\n    metric_collection_task.cancel()\r\n```\r\n\r\n@dkruchinin Will you support this repository? I can provide pull request for this issue."},"comment":{"url":"https://api.github.com/repos/dkruchinin/sanic-prometheus/issues/comments/350740950","html_url":"https://github.com/dkruchinin/sanic-prometheus/issues/4#issuecomment-350740950","issue_url":"https://api.github.com/repos/dkruchinin/sanic-prometheus/issues/4","id":350740950,"user":{"login":"dkruchinin","id":19095,"avatar_url":"https://avatars2.githubusercontent.com/u/19095?v=4","gravatar_id":"","url":"https://api.github.com/users/dkruchinin","html_url":"https://github.com/dkruchinin","followers_url":"https://api.github.com/users/dkruchinin/followers","following_url":"https://api.github.com/users/dkruchinin/following{/other_user}","gists_url":"https://api.github.com/users/dkruchinin/gists{/gist_id}","starred_url":"https://api.github.com/users/dkruchinin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkruchinin/subscriptions","organizations_url":"https://api.github.com/users/dkruchinin/orgs","repos_url":"https://api.github.com/users/dkruchinin/repos","events_url":"https://api.github.com/users/dkruchinin/events{/privacy}","received_events_url":"https://api.github.com/users/dkruchinin/received_events","type":"User","site_admin":false},"created_at":"2017-12-11T14:33:42Z","updated_at":"2017-12-11T14:33:42Z","author_association":"OWNER","body":"Hey,\r\nThanks for finding it out! Send me a PR and I'll happily merge it 🙏"}}
{"actor":{"display_login":"dkruchinin"}}