{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments/242482892","pull_request_review_id":186000418,"id":242482892,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjQ4Mjg5Mg==","diff_hunk":"@@ -250,9 +272,15 @@ func (s *Server) worker(metricOut chan<- *metrics.MetricSample, eventOut chan<-\n \t\t\t\t\t\tdogstatsdMetricParseErrors.Add(1)\n \t\t\t\t\t\tcontinue\n \t\t\t\t\t}\n+\n+\t\t\t\t\tif s.debugMetricsStats {\n+\t\t\t\t\t\ts.storeMetricsStats(sample.Tags)","path":"pkg/dogstatsd/server.go","position":109,"original_position":109,"commit_id":"139603f6c1fbc50132faf9d056ae1829abedd85a","original_commit_id":"139603f6c1fbc50132faf9d056ae1829abedd85a","user":{"login":"remeh","id":1798689,"node_id":"MDQ6VXNlcjE3OTg2ODk=","avatar_url":"https://avatars2.githubusercontent.com/u/1798689?v=4","gravatar_id":"","url":"https://api.github.com/users/remeh","html_url":"https://github.com/remeh","followers_url":"https://api.github.com/users/remeh/followers","following_url":"https://api.github.com/users/remeh/following{/other_user}","gists_url":"https://api.github.com/users/remeh/gists{/gist_id}","starred_url":"https://api.github.com/users/remeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remeh/subscriptions","organizations_url":"https://api.github.com/users/remeh/orgs","repos_url":"https://api.github.com/users/remeh/repos","events_url":"https://api.github.com/users/remeh/events{/privacy}","received_events_url":"https://api.github.com/users/remeh/received_events","type":"User","site_admin":false},"body":"Could have used a channel there, but I still would need a lock for the map (because the call of the command dogstatsd-stats (read) could be in the same time as writing processed metrics stats (write)).\r\nWe wouldn't benefit from the internal lock of the channel, thus, the only gain we would have from using a channel is that another routine would processed the map writes. However, I didn't see slow-down (in pkt processed per seconds) after having introduced this change, I've decided to go for the simplest implementation.","created_at":"2018-12-18T10:31:16Z","updated_at":"2018-12-18T10:31:17Z","html_url":"https://github.com/DataDog/datadog-agent/pull/2750#discussion_r242482892","pull_request_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments/242482892"},"html":{"href":"https://github.com/DataDog/datadog-agent/pull/2750#discussion_r242482892"},"pull_request":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750"}}},"pull_request":{"url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750","id":236890221,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2ODkwMjIx","html_url":"https://github.com/DataDog/datadog-agent/pull/2750","diff_url":"https://github.com/DataDog/datadog-agent/pull/2750.diff","patch_url":"https://github.com/DataDog/datadog-agent/pull/2750.patch","issue_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/2750","number":2750,"state":"open","locked":false,"title":"Add dogstatsd-stats command to print basic stats on metrics processed by dogstatsd.","user":{"login":"remeh","id":1798689,"node_id":"MDQ6VXNlcjE3OTg2ODk=","avatar_url":"https://avatars2.githubusercontent.com/u/1798689?v=4","gravatar_id":"","url":"https://api.github.com/users/remeh","html_url":"https://github.com/remeh","followers_url":"https://api.github.com/users/remeh/followers","following_url":"https://api.github.com/users/remeh/following{/other_user}","gists_url":"https://api.github.com/users/remeh/gists{/gist_id}","starred_url":"https://api.github.com/users/remeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remeh/subscriptions","organizations_url":"https://api.github.com/users/remeh/orgs","repos_url":"https://api.github.com/users/remeh/repos","events_url":"https://api.github.com/users/remeh/events{/privacy}","received_events_url":"https://api.github.com/users/remeh/received_events","type":"User","site_admin":false},"body":"### What does this PR do?\r\n\r\nAdd a `dogstatsd-stats` command to retrieve how many times metrics are processed by the dogstatsd server of the agent.\r\n\r\n### Motivation\r\n\r\nUseful to debug which metrics are the most active on the dogstatsd server and when was the last time we saw them. \r\n\r\nSample:\r\n\r\n```\r\nTag                                      | Count      | Last Seen\r\n-----------------------------------------------------------------------------\r\nmymetrics:sample                         | 2555928    | 2018-12-10 10:40:43.910442 +0100 CET\r\nmyversion:v1.0                           | 4884       | 2018-12-10 10:40:43.882487 +0100 CET\r\npriority:1                               | 654        | 2018-12-10 10:40:43.883324 +0100 CET\r\npriority:neg                             | 653        | 2018-12-10 10:40:43.883087 +0100 CET\r\n```\r\n\r\n### Additional Notes\r\n\r\nAs this feature slightly increase the cpu usage of the dogstatsd server, it is behind the new configuration flag: `dogstatsd_metrics_stats_enabled`.","created_at":"2018-12-07T14:45:32Z","updated_at":"2018-12-18T10:31:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e2d07839f31ce311ebb0387398c52923b024799e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[{"name":"agent-core","id":1224133,"node_id":"MDQ6VGVhbTEyMjQxMzM=","slug":"agent-core","description":"(formerly Croissant) Core Infra Agent and Agent packaging","privacy":"closed","url":"https://api.github.com/teams/1224133","members_url":"https://api.github.com/teams/1224133/members{/member}","repositories_url":"https://api.github.com/teams/1224133/repos","permission":"pull"}],"labels":[{"id":313604152,"node_id":"MDU6TGFiZWwzMTM2MDQxNTI=","url":"https://api.github.com/repos/DataDog/datadog-agent/labels/kind/enhancement","name":"kind/enhancement","color":"84b6eb","default":false},{"id":695415843,"node_id":"MDU6TGFiZWw2OTU0MTU4NDM=","url":"https://api.github.com/repos/DataDog/datadog-agent/labels/team/agent-core","name":"team/agent-core","color":"d4c5f9","default":false}],"milestone":{"url":"https://api.github.com/repos/DataDog/datadog-agent/milestones/43","html_url":"https://github.com/DataDog/datadog-agent/milestone/43","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/milestones/43/labels","id":3840828,"node_id":"MDk6TWlsZXN0b25lMzg0MDgyOA==","number":43,"title":"6.9.0","description":null,"creator":{"login":"xvello","id":6241083,"node_id":"MDQ6VXNlcjYyNDEwODM=","avatar_url":"https://avatars2.githubusercontent.com/u/6241083?v=4","gravatar_id":"","url":"https://api.github.com/users/xvello","html_url":"https://github.com/xvello","followers_url":"https://api.github.com/users/xvello/followers","following_url":"https://api.github.com/users/xvello/following{/other_user}","gists_url":"https://api.github.com/users/xvello/gists{/gist_id}","starred_url":"https://api.github.com/users/xvello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xvello/subscriptions","organizations_url":"https://api.github.com/users/xvello/orgs","repos_url":"https://api.github.com/users/xvello/repos","events_url":"https://api.github.com/users/xvello/events{/privacy}","received_events_url":"https://api.github.com/users/xvello/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":10,"state":"open","created_at":"2018-11-22T13:08:09Z","updated_at":"2018-12-17T16:20:33Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750/commits","review_comments_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750/comments","review_comment_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/2750/comments","statuses_url":"https://api.github.com/repos/DataDog/datadog-agent/statuses/139603f6c1fbc50132faf9d056ae1829abedd85a","head":{"label":"DataDog:remeh/dogstatsd-metric-stats","ref":"remeh/dogstatsd-metric-stats","sha":"139603f6c1fbc50132faf9d056ae1829abedd85a","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":49970739,"node_id":"MDEwOlJlcG9zaXRvcnk0OTk3MDczOQ==","name":"datadog-agent","full_name":"DataDog/datadog-agent","private":false,"owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/DataDog/datadog-agent","description":"Datadog Agent ","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-agent/deployments","created_at":"2016-01-19T17:40:41Z","updated_at":"2018-12-18T10:17:07Z","pushed_at":"2018-12-18T10:16:52Z","git_url":"git://github.com/DataDog/datadog-agent.git","ssh_url":"git@github.com:DataDog/datadog-agent.git","clone_url":"https://github.com/DataDog/datadog-agent.git","svn_url":"https://github.com/DataDog/datadog-agent","homepage":"https://docs.datadoghq.com/","size":18814,"stargazers_count":339,"watchers_count":339,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":160,"mirror_url":null,"archived":false,"open_issues_count":196,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":160,"open_issues":196,"watchers":339,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"3a0acb2232e839257bbf59415f510f495a2c36e4","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":49970739,"node_id":"MDEwOlJlcG9zaXRvcnk0OTk3MDczOQ==","name":"datadog-agent","full_name":"DataDog/datadog-agent","private":false,"owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/DataDog/datadog-agent","description":"Datadog Agent ","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-agent/deployments","created_at":"2016-01-19T17:40:41Z","updated_at":"2018-12-18T10:17:07Z","pushed_at":"2018-12-18T10:16:52Z","git_url":"git://github.com/DataDog/datadog-agent.git","ssh_url":"git@github.com:DataDog/datadog-agent.git","clone_url":"https://github.com/DataDog/datadog-agent.git","svn_url":"https://github.com/DataDog/datadog-agent","homepage":"https://docs.datadoghq.com/","size":18814,"stargazers_count":339,"watchers_count":339,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":160,"mirror_url":null,"archived":false,"open_issues_count":196,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":160,"open_issues":196,"watchers":339,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750"},"html":{"href":"https://github.com/DataDog/datadog-agent/pull/2750"},"issue":{"href":"https://api.github.com/repos/DataDog/datadog-agent/issues/2750"},"comments":{"href":"https://api.github.com/repos/DataDog/datadog-agent/issues/2750/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2750/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/datadog-agent/statuses/139603f6c1fbc50132faf9d056ae1829abedd85a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"remeh"}}