{"action":"created","comment":{"url":"https://api.github.com/repos/firehol/netdata/pulls/comments/193751240","pull_request_review_id":126786064,"id":193751240,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Mzc1MTI0MA==","diff_hunk":"@@ -140,11 +192,52 @@ def _auto_config(self):\n         if not self.port:\n             self.port = 8953\n \n+    def _generate_perthread_charts(self):\n+        # TODO: THis could probably be more efficient, but it's only\n+        # run once, so it probably doesn't really matter.\n+        for thread in range(0, self.threads):\n+            shortname = 'thread{0}'.format(thread)\n+            longname = 'Thread {0}'.format(thread)\n+            charts = dict()\n+            order = [[], [], []]\n+            count = 0\n+            for item in PER_THREAD_CHARTS:\n+                chartname = '{0}{1}'.format(shortname, item)\n+                order[count].append(chartname)\n+                count += 1\n+                charts[chartname] = deepcopy(PER_THREAD_CHARTS[item])\n+                charts[chartname]['options'][1] = charts[chartname]['options'][1].format(longname)\n+                for line in range(0, len(charts[chartname]['lines'])):\n+                    charts[chartname]['lines'][line][0] = charts[chartname]['lines'][line][0].format(shortname)\n+            self.order = self.order + order[0] + order[1] + order[2]\n+            self.definitions.update(charts)\n+            for key, value in PER_THREAD_STAT_MAP.items():\n+                STAT_MAP[key.format(shortname)] = (value[0].format(shortname), value[1])","path":"python.d/unbound.chart.py","position":127,"original_position":127,"commit_id":"2cf291a5be03a304757caebaf71c285c70fefe79","original_commit_id":"2cf291a5be03a304757caebaf71c285c70fefe79","user":{"login":"l2isbad","id":22274335,"node_id":"MDQ6VXNlcjIyMjc0MzM1","avatar_url":"https://avatars3.githubusercontent.com/u/22274335?v=4","gravatar_id":"","url":"https://api.github.com/users/l2isbad","html_url":"https://github.com/l2isbad","followers_url":"https://api.github.com/users/l2isbad/followers","following_url":"https://api.github.com/users/l2isbad/following{/other_user}","gists_url":"https://api.github.com/users/l2isbad/gists{/gist_id}","starred_url":"https://api.github.com/users/l2isbad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/l2isbad/subscriptions","organizations_url":"https://api.github.com/users/l2isbad/orgs","repos_url":"https://api.github.com/users/l2isbad/repos","events_url":"https://api.github.com/users/l2isbad/events{/privacy}","received_events_url":"https://api.github.com/users/l2isbad/received_events","type":"User","site_admin":false},"body":"<details><summary>example implementation (not tested at all)</summary>\r\n\r\n```python\r\n\r\ndef add_keys_to_stat_map(sname):\r\n\tfor key, value in PER_THREAD_STAT_MAP.items():\r\n\t\tSTAT_MAP[key.format(sname)] = value[0].format(sname), value[1]\r\n\t\t\r\ndef per_thread_charts(tid):\r\n\tsname = 'thread{0}'.format(tid)\r\n\tlname = 'Thread {0}'.format(tid)\r\n\torder = [\r\n\t\t'{0}_queries'.format(sname),\r\n\t\t'{0}_reqlist'.format(sname),\r\n\t\t'{0}_recursion'.format(sname),\r\n\t]\r\n\tсharts = {\r\n\t\torder[0]: {\r\n\t\t\t'options': [None, '{0} Queries Processed'.format(lname), 'queries', 'queries processed', 'unbound.threads.queries', 'line'],\r\n\t\t\t'lines': [\r\n\t\t\t\t['{0}_ratelimit'.format(sname), 'Ratelimited', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_cachemiss'.format(sname), 'Cache Miss', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_cachehit'.format(sname), 'Cache Hit', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_expired'.format(sname), 'Expired', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_prefetch'.format(sname), 'Prefetched', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_recursive'.format(sname), 'Recursive', 'absolute', 1, 1]\r\n\t\t\t\t]\r\n\t\t\t},\r\n\t\torder[1]: {\r\n\t\t\t'options': [None, '{0} Request List'.format(lname), 'items', 'request list', 'unbound.threads.reqlist', 'line'],\r\n\t\t\t'lines': [\r\n\t\t\t\t['{0}_reqlist_avg'.format(sname), 'Average Size', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_reqlist_max'.format(sname), 'Maximum Size', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_reqlist_overwritten'.format(sname), 'Overwritten Requests', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_reqlist_exceeded'.format(sname), 'Overruns', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_reqlist_current'.format(sname), 'Current Size', 'absolute', 1, 1],\r\n\t\t\t\t['{0}_reqlist_user'.format(sname), 'User Requests', 'absolute', 1, 1]\r\n\t\t\t\t]\r\n\t\t\t},\r\n\t\torder[2]: {\r\n\t\t\t'options': [None, '{0} Recursion Timings'.format(lname), 'seconds', 'recursive timings', 'unbound.threads.recursion', 'line'],\r\n\t\t\t'lines': [\r\n\t\t\t\t['{0}_recursive_avg'.format(sname), 'Average', 'absolute', 1, PRECISION],\r\n\t\t\t\t['{0}_recursive_med'.format(sname), 'Median', 'absolute', 1, PRECISION]\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t}\r\n\treturn order, сharts\r\n\r\nclass Service(SimpleService):\r\n\t...\r\n\t...\r\n\t...\r\n\tdef add_per_thread_charts(self):\r\n\t\tfor tid, _ in  enumerate(self.threads):\r\n\t\t\tadd_keys_to_stat_map(tid)  # <- WARNING! this is wrong (modify global variable in threading env)\r\n\t\t\torder, charts = per_thread_charts(tid)\r\n\t\t\tself.order.extend(order)\r\n\t\t\tself.charts.update(charts)\r\n\r\n```\r\n</details>","created_at":"2018-06-07T13:44:22Z","updated_at":"2018-06-07T13:44:23Z","html_url":"https://github.com/firehol/netdata/pull/3787#discussion_r193751240","pull_request_url":"https://api.github.com/repos/firehol/netdata/pulls/3787","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/firehol/netdata/pulls/comments/193751240"},"html":{"href":"https://github.com/firehol/netdata/pull/3787#discussion_r193751240"},"pull_request":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3787"}},"in_reply_to_id":193600539},"pull_request":{"url":"https://api.github.com/repos/firehol/netdata/pulls/3787","id":193046933,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMDQ2OTMz","html_url":"https://github.com/firehol/netdata/pull/3787","diff_url":"https://github.com/firehol/netdata/pull/3787.diff","patch_url":"https://github.com/firehol/netdata/pull/3787.patch","issue_url":"https://api.github.com/repos/firehol/netdata/issues/3787","number":3787,"state":"open","locked":false,"title":"Per-thread stats for Unbound.","user":{"login":"Ferroin","id":905151,"node_id":"MDQ6VXNlcjkwNTE1MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/905151?v=4","gravatar_id":"","url":"https://api.github.com/users/Ferroin","html_url":"https://github.com/Ferroin","followers_url":"https://api.github.com/users/Ferroin/followers","following_url":"https://api.github.com/users/Ferroin/following{/other_user}","gists_url":"https://api.github.com/users/Ferroin/gists{/gist_id}","starred_url":"https://api.github.com/users/Ferroin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ferroin/subscriptions","organizations_url":"https://api.github.com/users/Ferroin/orgs","repos_url":"https://api.github.com/users/Ferroin/repos","events_url":"https://api.github.com/users/Ferroin/events{/privacy}","received_events_url":"https://api.github.com/users/Ferroin/received_events","type":"User","site_admin":false},"body":"Unbound itself provides per-thread versions of almost all the stats we collect (everything we currently collect excpt for the 'extended' stats).  This PR adds the ability to collect this data, and displays it as a set of reduced-height charts below the main (global) charts for each Unbound instance for which it is enabled.  It provides a new configuration key `per_thread`, which if set to yes (defaults to no)  will enable this for the job.\r\n\r\nThe module queries the monitored instance of Unbound directly (using some rather hackish trickery to leverage the existing data collection code in `SocketService`) to determine how many threads to create charts for during the `check()` function, so it will not respond to changes in the number of threads at runtime, but the number of threads is something which is not likely to change much (if ever), and having this limitation means that the actual collection logic doesn't have to change at all (because we just update the dictionary used for mapping from returned data to dimensions when we create the chart definitions).\r\n\r\nThe PR also fixes some typos in the Unbound module documentation and config file, and removes the misguided override of the chart families that the code was previously doing.","created_at":"2018-06-06T15:09:34Z","updated_at":"2018-06-07T13:44:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16228f7fc6779e145a4e8985f136d42d53bab664","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/firehol/netdata/pulls/3787/commits","review_comments_url":"https://api.github.com/repos/firehol/netdata/pulls/3787/comments","review_comment_url":"https://api.github.com/repos/firehol/netdata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firehol/netdata/issues/3787/comments","statuses_url":"https://api.github.com/repos/firehol/netdata/statuses/2cf291a5be03a304757caebaf71c285c70fefe79","head":{"label":"Ferroin:unbound-per-thread-stats","ref":"unbound-per-thread-stats","sha":"2cf291a5be03a304757caebaf71c285c70fefe79","user":{"login":"Ferroin","id":905151,"node_id":"MDQ6VXNlcjkwNTE1MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/905151?v=4","gravatar_id":"","url":"https://api.github.com/users/Ferroin","html_url":"https://github.com/Ferroin","followers_url":"https://api.github.com/users/Ferroin/followers","following_url":"https://api.github.com/users/Ferroin/following{/other_user}","gists_url":"https://api.github.com/users/Ferroin/gists{/gist_id}","starred_url":"https://api.github.com/users/Ferroin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ferroin/subscriptions","organizations_url":"https://api.github.com/users/Ferroin/orgs","repos_url":"https://api.github.com/users/Ferroin/repos","events_url":"https://api.github.com/users/Ferroin/events{/privacy}","received_events_url":"https://api.github.com/users/Ferroin/received_events","type":"User","site_admin":false},"repo":{"id":123435635,"node_id":"MDEwOlJlcG9zaXRvcnkxMjM0MzU2MzU=","name":"netdata","full_name":"Ferroin/netdata","owner":{"login":"Ferroin","id":905151,"node_id":"MDQ6VXNlcjkwNTE1MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/905151?v=4","gravatar_id":"","url":"https://api.github.com/users/Ferroin","html_url":"https://github.com/Ferroin","followers_url":"https://api.github.com/users/Ferroin/followers","following_url":"https://api.github.com/users/Ferroin/following{/other_user}","gists_url":"https://api.github.com/users/Ferroin/gists{/gist_id}","starred_url":"https://api.github.com/users/Ferroin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ferroin/subscriptions","organizations_url":"https://api.github.com/users/Ferroin/orgs","repos_url":"https://api.github.com/users/Ferroin/repos","events_url":"https://api.github.com/users/Ferroin/events{/privacy}","received_events_url":"https://api.github.com/users/Ferroin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Ferroin/netdata","description":"Get control of your servers. Simple. Effective. Awesome! https://my-netdata.io/","fork":true,"url":"https://api.github.com/repos/Ferroin/netdata","forks_url":"https://api.github.com/repos/Ferroin/netdata/forks","keys_url":"https://api.github.com/repos/Ferroin/netdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ferroin/netdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ferroin/netdata/teams","hooks_url":"https://api.github.com/repos/Ferroin/netdata/hooks","issue_events_url":"https://api.github.com/repos/Ferroin/netdata/issues/events{/number}","events_url":"https://api.github.com/repos/Ferroin/netdata/events","assignees_url":"https://api.github.com/repos/Ferroin/netdata/assignees{/user}","branches_url":"https://api.github.com/repos/Ferroin/netdata/branches{/branch}","tags_url":"https://api.github.com/repos/Ferroin/netdata/tags","blobs_url":"https://api.github.com/repos/Ferroin/netdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ferroin/netdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ferroin/netdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ferroin/netdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ferroin/netdata/statuses/{sha}","languages_url":"https://api.github.com/repos/Ferroin/netdata/languages","stargazers_url":"https://api.github.com/repos/Ferroin/netdata/stargazers","contributors_url":"https://api.github.com/repos/Ferroin/netdata/contributors","subscribers_url":"https://api.github.com/repos/Ferroin/netdata/subscribers","subscription_url":"https://api.github.com/repos/Ferroin/netdata/subscription","commits_url":"https://api.github.com/repos/Ferroin/netdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ferroin/netdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ferroin/netdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ferroin/netdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ferroin/netdata/contents/{+path}","compare_url":"https://api.github.com/repos/Ferroin/netdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ferroin/netdata/merges","archive_url":"https://api.github.com/repos/Ferroin/netdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ferroin/netdata/downloads","issues_url":"https://api.github.com/repos/Ferroin/netdata/issues{/number}","pulls_url":"https://api.github.com/repos/Ferroin/netdata/pulls{/number}","milestones_url":"https://api.github.com/repos/Ferroin/netdata/milestones{/number}","notifications_url":"https://api.github.com/repos/Ferroin/netdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ferroin/netdata/labels{/name}","releases_url":"https://api.github.com/repos/Ferroin/netdata/releases{/id}","deployments_url":"https://api.github.com/repos/Ferroin/netdata/deployments","created_at":"2018-03-01T13:02:44Z","updated_at":"2018-06-01T18:51:46Z","pushed_at":"2018-06-06T18:13:43Z","git_url":"git://github.com/Ferroin/netdata.git","ssh_url":"git@github.com:Ferroin/netdata.git","clone_url":"https://github.com/Ferroin/netdata.git","svn_url":"https://github.com/Ferroin/netdata","homepage":"","size":24075,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"firehol:master","ref":"master","sha":"7da8ccfee649fb575f8d5acbcdcd6b42db2cf1b7","user":{"login":"firehol","id":9442231,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0NDIyMzE=","avatar_url":"https://avatars2.githubusercontent.com/u/9442231?v=4","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"repo":{"id":10744183,"node_id":"MDEwOlJlcG9zaXRvcnkxMDc0NDE4Mw==","name":"netdata","full_name":"firehol/netdata","owner":{"login":"firehol","id":9442231,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0NDIyMzE=","avatar_url":"https://avatars2.githubusercontent.com/u/9442231?v=4","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firehol/netdata","description":"Get control of your servers. Simple. Effective. Awesome! https://my-netdata.io/","fork":false,"url":"https://api.github.com/repos/firehol/netdata","forks_url":"https://api.github.com/repos/firehol/netdata/forks","keys_url":"https://api.github.com/repos/firehol/netdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firehol/netdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firehol/netdata/teams","hooks_url":"https://api.github.com/repos/firehol/netdata/hooks","issue_events_url":"https://api.github.com/repos/firehol/netdata/issues/events{/number}","events_url":"https://api.github.com/repos/firehol/netdata/events","assignees_url":"https://api.github.com/repos/firehol/netdata/assignees{/user}","branches_url":"https://api.github.com/repos/firehol/netdata/branches{/branch}","tags_url":"https://api.github.com/repos/firehol/netdata/tags","blobs_url":"https://api.github.com/repos/firehol/netdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firehol/netdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firehol/netdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/firehol/netdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firehol/netdata/statuses/{sha}","languages_url":"https://api.github.com/repos/firehol/netdata/languages","stargazers_url":"https://api.github.com/repos/firehol/netdata/stargazers","contributors_url":"https://api.github.com/repos/firehol/netdata/contributors","subscribers_url":"https://api.github.com/repos/firehol/netdata/subscribers","subscription_url":"https://api.github.com/repos/firehol/netdata/subscription","commits_url":"https://api.github.com/repos/firehol/netdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/firehol/netdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/firehol/netdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/firehol/netdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/firehol/netdata/contents/{+path}","compare_url":"https://api.github.com/repos/firehol/netdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firehol/netdata/merges","archive_url":"https://api.github.com/repos/firehol/netdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firehol/netdata/downloads","issues_url":"https://api.github.com/repos/firehol/netdata/issues{/number}","pulls_url":"https://api.github.com/repos/firehol/netdata/pulls{/number}","milestones_url":"https://api.github.com/repos/firehol/netdata/milestones{/number}","notifications_url":"https://api.github.com/repos/firehol/netdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firehol/netdata/labels{/name}","releases_url":"https://api.github.com/repos/firehol/netdata/releases{/id}","deployments_url":"https://api.github.com/repos/firehol/netdata/deployments","created_at":"2013-06-17T18:39:10Z","updated_at":"2018-06-07T13:10:44Z","pushed_at":"2018-06-07T00:43:42Z","git_url":"git://github.com/firehol/netdata.git","ssh_url":"git@github.com:firehol/netdata.git","clone_url":"https://github.com/firehol/netdata.git","svn_url":"https://github.com/firehol/netdata","homepage":"","size":23808,"stargazers_count":29837,"watchers_count":29837,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2515,"mirror_url":null,"archived":false,"open_issues_count":463,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2515,"open_issues":463,"watchers":29837,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3787"},"html":{"href":"https://github.com/firehol/netdata/pull/3787"},"issue":{"href":"https://api.github.com/repos/firehol/netdata/issues/3787"},"comments":{"href":"https://api.github.com/repos/firehol/netdata/issues/3787/comments"},"review_comments":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3787/comments"},"review_comment":{"href":"https://api.github.com/repos/firehol/netdata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3787/commits"},"statuses":{"href":"https://api.github.com/repos/firehol/netdata/statuses/2cf291a5be03a304757caebaf71c285c70fefe79"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"l2isbad"}}