{"action":"created","issue":{"url":"https://api.github.com/repos/prometheus/client_java/issues/438","repository_url":"https://api.github.com/repos/prometheus/client_java","labels_url":"https://api.github.com/repos/prometheus/client_java/issues/438/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/client_java/issues/438/comments","events_url":"https://api.github.com/repos/prometheus/client_java/issues/438/events","html_url":"https://github.com/prometheus/client_java/issues/438","id":378670858,"node_id":"MDU6SXNzdWUzNzg2NzA4NTg=","number":438,"title":"Number of threads when open Prometheus exporter server","user":{"login":"DatPhanTien","id":39366519,"node_id":"MDQ6VXNlcjM5MzY2NTE5","avatar_url":"https://avatars0.githubusercontent.com/u/39366519?v=4","gravatar_id":"","url":"https://api.github.com/users/DatPhanTien","html_url":"https://github.com/DatPhanTien","followers_url":"https://api.github.com/users/DatPhanTien/followers","following_url":"https://api.github.com/users/DatPhanTien/following{/other_user}","gists_url":"https://api.github.com/users/DatPhanTien/gists{/gist_id}","starred_url":"https://api.github.com/users/DatPhanTien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DatPhanTien/subscriptions","organizations_url":"https://api.github.com/users/DatPhanTien/orgs","repos_url":"https://api.github.com/users/DatPhanTien/repos","events_url":"https://api.github.com/users/DatPhanTien/events{/privacy}","received_events_url":"https://api.github.com/users/DatPhanTien/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-08T10:34:49Z","updated_at":"2018-11-08T10:53:15Z","closed_at":null,"author_association":"NONE","body":"Dear all,\r\n\r\nOur versions:\r\nPrometheus 0.5.0 \r\nCentOS 7.4\r\nJAVA hotspot 1.8.0_181\r\n\r\nWhen we open a HTTPServer (code https://github.com/prometheus/client_java/blob/master/simpleclient_httpserver/src/main/java/io/prometheus/client/exporter/HTTPServer.java) for exporting metrics, we noticed that the HTTP server opens an executor service of a pool of 5 threads by default (this value is hardcoded)\r\n`executorService = Executors.newFixedThreadPool(5, DaemonThreadFactory.defaultThreadFactory(daemon));`\r\n\r\nWe register our metric collector:\r\n`new OurCustomCollector().register();`\r\n\r\nWhen Prometheus collects the metric values, the `collect()` method is called 5 times instead of once (in 5 different threads as created above).\r\n`2018-11-08 11:12:02,221 - INFO  - pool-5-thread-3 - com.OurCustomCollector - Collecting the current custom metric\r\n2018-11-08 11:12:02,918 - INFO  - pool-5-thread-4 - com.OurCustomCollector - Collecting the current custom metric`\r\n\r\nCould you please let us know if this is normal? If it is NOT, what would be the reason?  Besides, what was the reason to set the number of threads hardcoded to the value of 5?\r\n\r\nBest\r\nTien Dat\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/prometheus/client_java/issues/comments/436954159","html_url":"https://github.com/prometheus/client_java/issues/438#issuecomment-436954159","issue_url":"https://api.github.com/repos/prometheus/client_java/issues/438","id":436954159,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjk1NDE1OQ==","user":{"login":"brian-brazil","id":7115638,"node_id":"MDQ6VXNlcjcxMTU2Mzg=","avatar_url":"https://avatars0.githubusercontent.com/u/7115638?v=4","gravatar_id":"","url":"https://api.github.com/users/brian-brazil","html_url":"https://github.com/brian-brazil","followers_url":"https://api.github.com/users/brian-brazil/followers","following_url":"https://api.github.com/users/brian-brazil/following{/other_user}","gists_url":"https://api.github.com/users/brian-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/brian-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brian-brazil/subscriptions","organizations_url":"https://api.github.com/users/brian-brazil/orgs","repos_url":"https://api.github.com/users/brian-brazil/repos","events_url":"https://api.github.com/users/brian-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/brian-brazil/received_events","type":"User","site_admin":false},"created_at":"2018-11-08T10:53:15Z","updated_at":"2018-11-08T10:53:15Z","author_association":"MEMBER","body":"What happens if you turn off the prometheus scraping, and hit it by hand?"}}
{"actor":{"display_login":"brian-brazil"}}