{"action":"created","comment":{"url":"https://api.github.com/repos/50onRed/flask-datadog/pulls/comments/91078912","pull_request_review_id":11588694,"id":91078912,"diff_hunk":"@@ -169,12 +172,21 @@ def after_request(self, response):\n         if self.config['DATADOG_RESPONSE_AUTO_TAG']:\n             self.add_request_tags(['status_code:%s' % (response.status_code, )])\n \n-        # Emit our timing metric\n-        self.statsd.timing(self.config['DATADOG_RESPONSE_METRIC_NAME'],\n+        tags = self.get_request_tags()\n+\n+        # Emit timing metric\n+        self.statsd.timing(self.config['DATADOG_RESPONSE_TIME_METRIC_NAME'],\n                            elapsed,\n-                           self.get_request_tags(),\n+                           tags,\n                            self.config['DATADOG_RESPONSE_SAMPLE_RATE'])\n \n+        # Emit response size metric\n+        size = len(response.data)","path":"flask_datadog.py","position":49,"original_position":49,"commit_id":"5740caa42a4796a68c12c4a8304bb99da5544a21","original_commit_id":"5740caa42a4796a68c12c4a8304bb99da5544a21","user":{"login":"brettlangdon","id":1320353,"avatar_url":"https://avatars.githubusercontent.com/u/1320353?v=3","gravatar_id":"","url":"https://api.github.com/users/brettlangdon","html_url":"https://github.com/brettlangdon","followers_url":"https://api.github.com/users/brettlangdon/followers","following_url":"https://api.github.com/users/brettlangdon/following{/other_user}","gists_url":"https://api.github.com/users/brettlangdon/gists{/gist_id}","starred_url":"https://api.github.com/users/brettlangdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettlangdon/subscriptions","organizations_url":"https://api.github.com/users/brettlangdon/orgs","repos_url":"https://api.github.com/users/brettlangdon/repos","events_url":"https://api.github.com/users/brettlangdon/events{/privacy}","received_events_url":"https://api.github.com/users/brettlangdon/received_events","type":"User","site_admin":false},"body":"Instead you could do `int(response.headers['content-length'])` since it should already have been computed.\r\n\r\nI am not sure under what conditions `content-length` is *not* available, so maybe something like this would be better?\r\n\r\n```python\r\nif 'content-length' in response.headers:\r\n    size = int(response.headers['content-length'])\r\n    self.statsd.increment(...)\r\n```","created_at":"2016-12-06T13:42:54Z","updated_at":"2016-12-06T13:46:26Z","html_url":"https://github.com/50onRed/flask-datadog/pull/9#discussion_r91078912","pull_request_url":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/50onRed/flask-datadog/pulls/comments/91078912"},"html":{"href":"https://github.com/50onRed/flask-datadog/pull/9#discussion_r91078912"},"pull_request":{"href":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9","id":96682184,"html_url":"https://github.com/50onRed/flask-datadog/pull/9","diff_url":"https://github.com/50onRed/flask-datadog/pull/9.diff","patch_url":"https://github.com/50onRed/flask-datadog/pull/9.patch","issue_url":"https://api.github.com/repos/50onRed/flask-datadog/issues/9","number":9,"state":"open","locked":false,"title":"Fix TimerWrapper + Add response size metric","user":{"login":"Monichev","id":14152903,"avatar_url":"https://avatars.githubusercontent.com/u/14152903?v=3","gravatar_id":"","url":"https://api.github.com/users/Monichev","html_url":"https://github.com/Monichev","followers_url":"https://api.github.com/users/Monichev/followers","following_url":"https://api.github.com/users/Monichev/following{/other_user}","gists_url":"https://api.github.com/users/Monichev/gists{/gist_id}","starred_url":"https://api.github.com/users/Monichev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Monichev/subscriptions","organizations_url":"https://api.github.com/users/Monichev/orgs","repos_url":"https://api.github.com/users/Monichev/repos","events_url":"https://api.github.com/users/Monichev/events{/privacy}","received_events_url":"https://api.github.com/users/Monichev/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-06T08:45:54Z","updated_at":"2016-12-06T13:46:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bf9d19093ff42c44992992c4f92704856545599","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9/commits","review_comments_url":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9/comments","review_comment_url":"https://api.github.com/repos/50onRed/flask-datadog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/50onRed/flask-datadog/issues/9/comments","statuses_url":"https://api.github.com/repos/50onRed/flask-datadog/statuses/5740caa42a4796a68c12c4a8304bb99da5544a21","head":{"label":"Monichev:master","ref":"master","sha":"5740caa42a4796a68c12c4a8304bb99da5544a21","user":{"login":"Monichev","id":14152903,"avatar_url":"https://avatars.githubusercontent.com/u/14152903?v=3","gravatar_id":"","url":"https://api.github.com/users/Monichev","html_url":"https://github.com/Monichev","followers_url":"https://api.github.com/users/Monichev/followers","following_url":"https://api.github.com/users/Monichev/following{/other_user}","gists_url":"https://api.github.com/users/Monichev/gists{/gist_id}","starred_url":"https://api.github.com/users/Monichev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Monichev/subscriptions","organizations_url":"https://api.github.com/users/Monichev/orgs","repos_url":"https://api.github.com/users/Monichev/repos","events_url":"https://api.github.com/users/Monichev/events{/privacy}","received_events_url":"https://api.github.com/users/Monichev/received_events","type":"User","site_admin":false},"repo":{"id":75394291,"name":"flask-datadog","full_name":"Monichev/flask-datadog","owner":{"login":"Monichev","id":14152903,"avatar_url":"https://avatars.githubusercontent.com/u/14152903?v=3","gravatar_id":"","url":"https://api.github.com/users/Monichev","html_url":"https://github.com/Monichev","followers_url":"https://api.github.com/users/Monichev/followers","following_url":"https://api.github.com/users/Monichev/following{/other_user}","gists_url":"https://api.github.com/users/Monichev/gists{/gist_id}","starred_url":"https://api.github.com/users/Monichev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Monichev/subscriptions","organizations_url":"https://api.github.com/users/Monichev/orgs","repos_url":"https://api.github.com/users/Monichev/repos","events_url":"https://api.github.com/users/Monichev/events{/privacy}","received_events_url":"https://api.github.com/users/Monichev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Monichev/flask-datadog","description":"Access statsd from your app","fork":true,"url":"https://api.github.com/repos/Monichev/flask-datadog","forks_url":"https://api.github.com/repos/Monichev/flask-datadog/forks","keys_url":"https://api.github.com/repos/Monichev/flask-datadog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Monichev/flask-datadog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Monichev/flask-datadog/teams","hooks_url":"https://api.github.com/repos/Monichev/flask-datadog/hooks","issue_events_url":"https://api.github.com/repos/Monichev/flask-datadog/issues/events{/number}","events_url":"https://api.github.com/repos/Monichev/flask-datadog/events","assignees_url":"https://api.github.com/repos/Monichev/flask-datadog/assignees{/user}","branches_url":"https://api.github.com/repos/Monichev/flask-datadog/branches{/branch}","tags_url":"https://api.github.com/repos/Monichev/flask-datadog/tags","blobs_url":"https://api.github.com/repos/Monichev/flask-datadog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Monichev/flask-datadog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Monichev/flask-datadog/git/refs{/sha}","trees_url":"https://api.github.com/repos/Monichev/flask-datadog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Monichev/flask-datadog/statuses/{sha}","languages_url":"https://api.github.com/repos/Monichev/flask-datadog/languages","stargazers_url":"https://api.github.com/repos/Monichev/flask-datadog/stargazers","contributors_url":"https://api.github.com/repos/Monichev/flask-datadog/contributors","subscribers_url":"https://api.github.com/repos/Monichev/flask-datadog/subscribers","subscription_url":"https://api.github.com/repos/Monichev/flask-datadog/subscription","commits_url":"https://api.github.com/repos/Monichev/flask-datadog/commits{/sha}","git_commits_url":"https://api.github.com/repos/Monichev/flask-datadog/git/commits{/sha}","comments_url":"https://api.github.com/repos/Monichev/flask-datadog/comments{/number}","issue_comment_url":"https://api.github.com/repos/Monichev/flask-datadog/issues/comments{/number}","contents_url":"https://api.github.com/repos/Monichev/flask-datadog/contents/{+path}","compare_url":"https://api.github.com/repos/Monichev/flask-datadog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Monichev/flask-datadog/merges","archive_url":"https://api.github.com/repos/Monichev/flask-datadog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Monichev/flask-datadog/downloads","issues_url":"https://api.github.com/repos/Monichev/flask-datadog/issues{/number}","pulls_url":"https://api.github.com/repos/Monichev/flask-datadog/pulls{/number}","milestones_url":"https://api.github.com/repos/Monichev/flask-datadog/milestones{/number}","notifications_url":"https://api.github.com/repos/Monichev/flask-datadog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Monichev/flask-datadog/labels{/name}","releases_url":"https://api.github.com/repos/Monichev/flask-datadog/releases{/id}","deployments_url":"https://api.github.com/repos/Monichev/flask-datadog/deployments","created_at":"2016-12-02T12:35:18Z","updated_at":"2016-12-02T12:35:19Z","pushed_at":"2016-12-05T14:02:14Z","git_url":"git://github.com/Monichev/flask-datadog.git","ssh_url":"git@github.com:Monichev/flask-datadog.git","clone_url":"https://github.com/Monichev/flask-datadog.git","svn_url":"https://github.com/Monichev/flask-datadog","homepage":"","size":10,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"50onRed:master","ref":"master","sha":"c5df6e464b7a932e50c59d06cdb88f5d62036b1e","user":{"login":"50onRed","id":1286669,"avatar_url":"https://avatars.githubusercontent.com/u/1286669?v=3","gravatar_id":"","url":"https://api.github.com/users/50onRed","html_url":"https://github.com/50onRed","followers_url":"https://api.github.com/users/50onRed/followers","following_url":"https://api.github.com/users/50onRed/following{/other_user}","gists_url":"https://api.github.com/users/50onRed/gists{/gist_id}","starred_url":"https://api.github.com/users/50onRed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/50onRed/subscriptions","organizations_url":"https://api.github.com/users/50onRed/orgs","repos_url":"https://api.github.com/users/50onRed/repos","events_url":"https://api.github.com/users/50onRed/events{/privacy}","received_events_url":"https://api.github.com/users/50onRed/received_events","type":"Organization","site_admin":false},"repo":{"id":49604620,"name":"flask-datadog","full_name":"50onRed/flask-datadog","owner":{"login":"50onRed","id":1286669,"avatar_url":"https://avatars.githubusercontent.com/u/1286669?v=3","gravatar_id":"","url":"https://api.github.com/users/50onRed","html_url":"https://github.com/50onRed","followers_url":"https://api.github.com/users/50onRed/followers","following_url":"https://api.github.com/users/50onRed/following{/other_user}","gists_url":"https://api.github.com/users/50onRed/gists{/gist_id}","starred_url":"https://api.github.com/users/50onRed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/50onRed/subscriptions","organizations_url":"https://api.github.com/users/50onRed/orgs","repos_url":"https://api.github.com/users/50onRed/repos","events_url":"https://api.github.com/users/50onRed/events{/privacy}","received_events_url":"https://api.github.com/users/50onRed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/50onRed/flask-datadog","description":"Access statsd from your app","fork":true,"url":"https://api.github.com/repos/50onRed/flask-datadog","forks_url":"https://api.github.com/repos/50onRed/flask-datadog/forks","keys_url":"https://api.github.com/repos/50onRed/flask-datadog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/50onRed/flask-datadog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/50onRed/flask-datadog/teams","hooks_url":"https://api.github.com/repos/50onRed/flask-datadog/hooks","issue_events_url":"https://api.github.com/repos/50onRed/flask-datadog/issues/events{/number}","events_url":"https://api.github.com/repos/50onRed/flask-datadog/events","assignees_url":"https://api.github.com/repos/50onRed/flask-datadog/assignees{/user}","branches_url":"https://api.github.com/repos/50onRed/flask-datadog/branches{/branch}","tags_url":"https://api.github.com/repos/50onRed/flask-datadog/tags","blobs_url":"https://api.github.com/repos/50onRed/flask-datadog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/50onRed/flask-datadog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/50onRed/flask-datadog/git/refs{/sha}","trees_url":"https://api.github.com/repos/50onRed/flask-datadog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/50onRed/flask-datadog/statuses/{sha}","languages_url":"https://api.github.com/repos/50onRed/flask-datadog/languages","stargazers_url":"https://api.github.com/repos/50onRed/flask-datadog/stargazers","contributors_url":"https://api.github.com/repos/50onRed/flask-datadog/contributors","subscribers_url":"https://api.github.com/repos/50onRed/flask-datadog/subscribers","subscription_url":"https://api.github.com/repos/50onRed/flask-datadog/subscription","commits_url":"https://api.github.com/repos/50onRed/flask-datadog/commits{/sha}","git_commits_url":"https://api.github.com/repos/50onRed/flask-datadog/git/commits{/sha}","comments_url":"https://api.github.com/repos/50onRed/flask-datadog/comments{/number}","issue_comment_url":"https://api.github.com/repos/50onRed/flask-datadog/issues/comments{/number}","contents_url":"https://api.github.com/repos/50onRed/flask-datadog/contents/{+path}","compare_url":"https://api.github.com/repos/50onRed/flask-datadog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/50onRed/flask-datadog/merges","archive_url":"https://api.github.com/repos/50onRed/flask-datadog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/50onRed/flask-datadog/downloads","issues_url":"https://api.github.com/repos/50onRed/flask-datadog/issues{/number}","pulls_url":"https://api.github.com/repos/50onRed/flask-datadog/pulls{/number}","milestones_url":"https://api.github.com/repos/50onRed/flask-datadog/milestones{/number}","notifications_url":"https://api.github.com/repos/50onRed/flask-datadog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/50onRed/flask-datadog/labels{/name}","releases_url":"https://api.github.com/repos/50onRed/flask-datadog/releases{/id}","deployments_url":"https://api.github.com/repos/50onRed/flask-datadog/deployments","created_at":"2016-01-13T21:55:16Z","updated_at":"2016-12-04T19:45:08Z","pushed_at":"2016-12-06T08:45:54Z","git_url":"git://github.com/50onRed/flask-datadog.git","ssh_url":"git@github.com:50onRed/flask-datadog.git","clone_url":"https://github.com/50onRed/flask-datadog.git","svn_url":"https://github.com/50onRed/flask-datadog","homepage":"","size":9,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9"},"html":{"href":"https://github.com/50onRed/flask-datadog/pull/9"},"issue":{"href":"https://api.github.com/repos/50onRed/flask-datadog/issues/9"},"comments":{"href":"https://api.github.com/repos/50onRed/flask-datadog/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/50onRed/flask-datadog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/50onRed/flask-datadog/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/50onRed/flask-datadog/statuses/5740caa42a4796a68c12c4a8304bb99da5544a21"}}}}
{"actor":{"display_login":"brettlangdon"}}