{"action":"created","issue":{"url":"https://api.github.com/repos/deadtrickster/prometheus.erl/issues/66","repository_url":"https://api.github.com/repos/deadtrickster/prometheus.erl","labels_url":"https://api.github.com/repos/deadtrickster/prometheus.erl/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/deadtrickster/prometheus.erl/issues/66/comments","events_url":"https://api.github.com/repos/deadtrickster/prometheus.erl/issues/66/events","html_url":"https://github.com/deadtrickster/prometheus.erl/issues/66","id":231123682,"number":66,"title":"prometheus:stop() hangs when run from an ejabberd module","user":{"login":"marcphilipp","id":214207,"avatar_url":"https://avatars1.githubusercontent.com/u/214207?v=3","gravatar_id":"","url":"https://api.github.com/users/marcphilipp","html_url":"https://github.com/marcphilipp","followers_url":"https://api.github.com/users/marcphilipp/followers","following_url":"https://api.github.com/users/marcphilipp/following{/other_user}","gists_url":"https://api.github.com/users/marcphilipp/gists{/gist_id}","starred_url":"https://api.github.com/users/marcphilipp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcphilipp/subscriptions","organizations_url":"https://api.github.com/users/marcphilipp/orgs","repos_url":"https://api.github.com/users/marcphilipp/repos","events_url":"https://api.github.com/users/marcphilipp/events{/privacy}","received_events_url":"https://api.github.com/users/marcphilipp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-05-24T18:01:08Z","updated_at":"2017-07-10T17:26:15Z","closed_at":null,"body":"First of all, thanks for creating this library, very useful!\r\n\r\nI'm trying to implement an ejabberd module that uses `prometheus`:\r\n\r\nHere's what I have:\r\n\r\n```erlang\r\n-module(mod_prometheus).\r\n\r\n-include(\"ejabberd_http.hrl\").\r\n-include(\"logger.hrl\").\r\n\r\n-behavior(gen_mod).\r\n\r\n-export([\r\n  start/2,\r\n  stop/1,\r\n  depends/2,\r\n  mod_opt_type/1,\r\n  process/2\r\n]).\r\n\r\nstart(Host, _Opts) ->\r\n  ?INFO_MSG(\"~s starting on ~p\", [?MODULE, Host]),\r\n  prometheus:start().\r\n\r\nstop(Host) ->\r\n  ?INFO_MSG(\"~s stopping on ~p\", [?MODULE, Host]),\r\n  prometheus:stop(),\r\n  ?INFO_MSG(\"~s stopped on ~p\", [?MODULE, Host]),\r\n  ok.\r\n\r\ndepends(_Host, _Opts) ->\r\n  [].\r\n\r\nmod_opt_type(_) ->\r\n  [].\r\n\r\nprocess([], #request{method = 'GET'}) ->\r\n  {\r\n    200,\r\n    [{<<\"Content-Type\">>, prometheus_text_format:content_type()}],\r\n    prometheus_text_format:format()\r\n  }.\r\n```\r\n\r\nHowever, when I shutdown/restart ejabberd, `prometheus:stop()` never returns:\r\n\r\n```\r\n[...]\r\n2017-05-24 17:55:34.446 [info] <0.63.0>@mod_prometheus:stop:30 mod_prometheus stopping on <<\"localhost\">>\r\n```\r\n\r\nDo you have an idea how I can find out what's going on? Any help would be highly appreciated!"},"comment":{"url":"https://api.github.com/repos/deadtrickster/prometheus.erl/issues/comments/314176252","html_url":"https://github.com/deadtrickster/prometheus.erl/issues/66#issuecomment-314176252","issue_url":"https://api.github.com/repos/deadtrickster/prometheus.erl/issues/66","id":314176252,"user":{"login":"marcphilipp","id":214207,"avatar_url":"https://avatars1.githubusercontent.com/u/214207?v=3","gravatar_id":"","url":"https://api.github.com/users/marcphilipp","html_url":"https://github.com/marcphilipp","followers_url":"https://api.github.com/users/marcphilipp/followers","following_url":"https://api.github.com/users/marcphilipp/following{/other_user}","gists_url":"https://api.github.com/users/marcphilipp/gists{/gist_id}","starred_url":"https://api.github.com/users/marcphilipp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcphilipp/subscriptions","organizations_url":"https://api.github.com/users/marcphilipp/orgs","repos_url":"https://api.github.com/users/marcphilipp/repos","events_url":"https://api.github.com/users/marcphilipp/events{/privacy}","received_events_url":"https://api.github.com/users/marcphilipp/received_events","type":"User","site_admin":false},"created_at":"2017-07-10T17:26:15Z","updated_at":"2017-07-10T17:26:15Z","body":"Yes, you can stop plugins for a specific host. For me, that's not a problem. But for the general case that's undesirable. I guess it would be better to \"attach\" it to the ejabberd application but I don't think ejabberd provides a hook to do so. "}}
{"actor":{"display_login":"marcphilipp"}}