{"action":"created","issue":{"url":"https://api.github.com/repos/prometheus/client_python/issues/98","repository_url":"https://api.github.com/repos/prometheus/client_python","labels_url":"https://api.github.com/repos/prometheus/client_python/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/client_python/issues/98/comments","events_url":"https://api.github.com/repos/prometheus/client_python/issues/98/events","html_url":"https://github.com/prometheus/client_python/issues/98","id":175339721,"number":98,"title":"Metrics all to zero ... noob","user":{"login":"eMerzh","id":177003,"avatar_url":"https://avatars.githubusercontent.com/u/177003?v=3","gravatar_id":"","url":"https://api.github.com/users/eMerzh","html_url":"https://github.com/eMerzh","followers_url":"https://api.github.com/users/eMerzh/followers","following_url":"https://api.github.com/users/eMerzh/following{/other_user}","gists_url":"https://api.github.com/users/eMerzh/gists{/gist_id}","starred_url":"https://api.github.com/users/eMerzh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eMerzh/subscriptions","organizations_url":"https://api.github.com/users/eMerzh/orgs","repos_url":"https://api.github.com/users/eMerzh/repos","events_url":"https://api.github.com/users/eMerzh/events{/privacy}","received_events_url":"https://api.github.com/users/eMerzh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-06T20:11:26Z","updated_at":"2016-09-06T20:28:14Z","closed_at":null,"body":"Hi, \r\nthanks for your work on the lib! \r\ndisclaimer: i'm a noob in prometheus and in using this lib... so i might miss something obvious \r\n\r\ni'm trying to use it in my flask app\r\nso i did : \r\n```\r\nc = Counter('my_failures_total', 'Description of counter')\r\n\r\n@app.route('/brol')\r\ndef brol():\r\n    c.inc()     # Increment by 1\r\n    c.inc(1.6)  # Increment by given value\r\n    return 'hello world'\r\n\r\n\r\nif __name__ == '__main__':\r\n    start_http_server(9012)\r\n    app.run()\r\n```\r\ni go with my browser on localhost:5000/brol  multiple times... \r\nthen go to localhost:9012 and the response i got is  : \r\n```\r\n# HELP my_failures_total Description of counter\r\n# TYPE my_failures_total counter\r\nmy_failures_total 0.0\r\n```\r\neven if i refresh /brol or :9012 the my_failures_total is always 0.\r\n\r\nbtw i often got in my console\r\n```\r\n\r\nException in thread Thread-1:\r\nTraceback (most recent call last):\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py\", line 810, in __bootstrap_inner\r\n    self.run()\r\n  File \"/Users/bmaron/Code/profiler-gui/venv/lib/python2.7/site-packages/prometheus_client/exposition.py\", line 86, in run\r\n    httpd = HTTPServer((addr, port), MetricsHandler)\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py\", line 420, in __init__\r\n    self.server_bind()\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py\", line 108, in server_bind\r\n    SocketServer.TCPServer.server_bind(self)\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py\", line 434, in server_bind\r\n    self.socket.bind(self.server_address)\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py\", line 228, in meth\r\n    return getattr(self._sock,name)(*args)\r\nerror: [Errno 48] Address already in use\r\n```\r\ni suppose it's related, but tried to relaunch, change port, ... it seems to be caused by the way i instantiate the start_http_server"},"comment":{"url":"https://api.github.com/repos/prometheus/client_python/issues/comments/245079982","html_url":"https://github.com/prometheus/client_python/issues/98#issuecomment-245079982","issue_url":"https://api.github.com/repos/prometheus/client_python/issues/98","id":245079982,"user":{"login":"eMerzh","id":177003,"avatar_url":"https://avatars.githubusercontent.com/u/177003?v=3","gravatar_id":"","url":"https://api.github.com/users/eMerzh","html_url":"https://github.com/eMerzh","followers_url":"https://api.github.com/users/eMerzh/followers","following_url":"https://api.github.com/users/eMerzh/following{/other_user}","gists_url":"https://api.github.com/users/eMerzh/gists{/gist_id}","starred_url":"https://api.github.com/users/eMerzh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eMerzh/subscriptions","organizations_url":"https://api.github.com/users/eMerzh/orgs","repos_url":"https://api.github.com/users/eMerzh/repos","events_url":"https://api.github.com/users/eMerzh/events{/privacy}","received_events_url":"https://api.github.com/users/eMerzh/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T20:28:14Z","updated_at":"2016-09-06T20:28:14Z","body":"nope just launching \r\n```\r\n python run.py\r\n```\r\nin DEBUG mode..."}}
{"actor":{"display_login":"eMerzh"}}