{"action":"created","comment":{"url":"https://api.github.com/repos/tspurway/infernyx/pulls/comments/30278302","id":30278302,"diff_hunk":"@@ -231,6 +232,44 @@ def report_rule_stats(job):\n         log.error(\"Error writing stats %s\" % e)\n \n \n+def report_suspicious_ips(it, params, job_id):\n+    total_ips = 0\n+    ips = []\n+    for (_, ip), (total,) in it:\n+        if total_ips >= 1000:\n+            break\n+        ips.append(\"%20s %d\" % (ip, total))\n+        total_ips += 1\n+\n+    if total_ips:\n+        msg = '\\n'.join(ips)\n+        statsd.event(\"Suspicious IP report\", msg)","path":"infernyx/rules.py","position":47,"original_position":47,"commit_id":"04b5b7dbe57020a48f8615cdc9b97c08a7d95461","original_commit_id":"04b5b7dbe57020a48f8615cdc9b97c08a7d95461","user":{"login":"tspurway","id":25276,"avatar_url":"https://avatars.githubusercontent.com/u/25276?v=3","gravatar_id":"","url":"https://api.github.com/users/tspurway","html_url":"https://github.com/tspurway","followers_url":"https://api.github.com/users/tspurway/followers","following_url":"https://api.github.com/users/tspurway/following{/other_user}","gists_url":"https://api.github.com/users/tspurway/gists{/gist_id}","starred_url":"https://api.github.com/users/tspurway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspurway/subscriptions","organizations_url":"https://api.github.com/users/tspurway/orgs","repos_url":"https://api.github.com/users/tspurway/repos","events_url":"https://api.github.com/users/tspurway/events{/privacy}","received_events_url":"https://api.github.com/users/tspurway/received_events","type":"User","site_admin":false},"body":"can you doublecheck the 8k limit for datadog?  that kind of sucks.\n\nOn Wed, May 13, 2015 at 5:17 PM, Nan Jiang <notifications@github.com> wrote:\n\n> In infernyx/rules.py\n> <https://github.com/tspurway/infernyx/pull/20#discussion_r30277231>:\n>\n> > @@ -231,6 +232,44 @@ def report_rule_stats(job):\n> >          log.error(\"Error writing stats %s\" % e)\n> >\n> >\n> > +def report_suspicious_ips(it, params, job_id):\n> > +    total_ips = 0\n> > +    ips = []\n> > +    for (_, ip), (total,) in it:\n> > +        if total_ips >= 1000:\n> > +            break\n> > +        ips.append(\"%20s %d\" % (ip, total))\n> > +        total_ips += 1\n> > +\n> > +    if total_ips:\n> > +        msg = '\\n'.join(ips)\n> > +        statsd.event(\"Suspicious IP report\", msg)\n>\n> The statsd.event() will raise an exception if the length of msg is\n> greater than 8k. We'd better drop an exception handler here.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/tspurway/infernyx/pull/20/files#r30277231>.\n>\n","created_at":"2015-05-13T21:28:14Z","updated_at":"2015-05-13T21:28:14Z","html_url":"https://github.com/tspurway/infernyx/pull/20#discussion_r30278302","pull_request_url":"https://api.github.com/repos/tspurway/infernyx/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/tspurway/infernyx/pulls/comments/30278302"},"html":{"href":"https://github.com/tspurway/infernyx/pull/20#discussion_r30278302"},"pull_request":{"href":"https://api.github.com/repos/tspurway/infernyx/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/tspurway/infernyx/pulls/20","id":34859051,"html_url":"https://github.com/tspurway/infernyx/pull/20","diff_url":"https://github.com/tspurway/infernyx/pull/20.diff","patch_url":"https://github.com/tspurway/infernyx/pull/20.patch","issue_url":"https://api.github.com/repos/tspurway/infernyx/issues/20","number":20,"state":"open","locked":false,"title":"feature_ip_click_counter","user":{"login":"tspurway","id":25276,"avatar_url":"https://avatars.githubusercontent.com/u/25276?v=3","gravatar_id":"","url":"https://api.github.com/users/tspurway","html_url":"https://github.com/tspurway","followers_url":"https://api.github.com/users/tspurway/followers","following_url":"https://api.github.com/users/tspurway/following{/other_user}","gists_url":"https://api.github.com/users/tspurway/gists{/gist_id}","starred_url":"https://api.github.com/users/tspurway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspurway/subscriptions","organizations_url":"https://api.github.com/users/tspurway/orgs","repos_url":"https://api.github.com/users/tspurway/repos","events_url":"https://api.github.com/users/tspurway/events{/privacy}","received_events_url":"https://api.github.com/users/tspurway/received_events","type":"User","site_admin":false},"body":"This is a 'fraud detector'.  It works by running an Inferno job daily (1am) on the previous day's click/impression stream data and counting excessively repetitive clicks from specific IP addresses.  \n\nIt uses datadog statsd events to report.\n\nr? @oyiptong","created_at":"2015-05-06T20:54:16Z","updated_at":"2015-05-13T21:28:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c895c087d6eac9abd6ffa3904a2c1189f6cd029","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tspurway/infernyx/pulls/20/commits","review_comments_url":"https://api.github.com/repos/tspurway/infernyx/pulls/20/comments","review_comment_url":"https://api.github.com/repos/tspurway/infernyx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tspurway/infernyx/issues/20/comments","statuses_url":"https://api.github.com/repos/tspurway/infernyx/statuses/04b5b7dbe57020a48f8615cdc9b97c08a7d95461","head":{"label":"tspurway:feature_ip_click_counter","ref":"feature_ip_click_counter","sha":"04b5b7dbe57020a48f8615cdc9b97c08a7d95461","user":{"login":"tspurway","id":25276,"avatar_url":"https://avatars.githubusercontent.com/u/25276?v=3","gravatar_id":"","url":"https://api.github.com/users/tspurway","html_url":"https://github.com/tspurway","followers_url":"https://api.github.com/users/tspurway/followers","following_url":"https://api.github.com/users/tspurway/following{/other_user}","gists_url":"https://api.github.com/users/tspurway/gists{/gist_id}","starred_url":"https://api.github.com/users/tspurway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspurway/subscriptions","organizations_url":"https://api.github.com/users/tspurway/orgs","repos_url":"https://api.github.com/users/tspurway/repos","events_url":"https://api.github.com/users/tspurway/events{/privacy}","received_events_url":"https://api.github.com/users/tspurway/received_events","type":"User","site_admin":false},"repo":{"id":22765535,"name":"infernyx","full_name":"tspurway/infernyx","owner":{"login":"tspurway","id":25276,"avatar_url":"https://avatars.githubusercontent.com/u/25276?v=3","gravatar_id":"","url":"https://api.github.com/users/tspurway","html_url":"https://github.com/tspurway","followers_url":"https://api.github.com/users/tspurway/followers","following_url":"https://api.github.com/users/tspurway/following{/other_user}","gists_url":"https://api.github.com/users/tspurway/gists{/gist_id}","starred_url":"https://api.github.com/users/tspurway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspurway/subscriptions","organizations_url":"https://api.github.com/users/tspurway/orgs","repos_url":"https://api.github.com/users/tspurway/repos","events_url":"https://api.github.com/users/tspurway/events{/privacy}","received_events_url":"https://api.github.com/users/tspurway/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tspurway/infernyx","description":"Inferno Rules and Schemas for Tiles project","fork":false,"url":"https://api.github.com/repos/tspurway/infernyx","forks_url":"https://api.github.com/repos/tspurway/infernyx/forks","keys_url":"https://api.github.com/repos/tspurway/infernyx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tspurway/infernyx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tspurway/infernyx/teams","hooks_url":"https://api.github.com/repos/tspurway/infernyx/hooks","issue_events_url":"https://api.github.com/repos/tspurway/infernyx/issues/events{/number}","events_url":"https://api.github.com/repos/tspurway/infernyx/events","assignees_url":"https://api.github.com/repos/tspurway/infernyx/assignees{/user}","branches_url":"https://api.github.com/repos/tspurway/infernyx/branches{/branch}","tags_url":"https://api.github.com/repos/tspurway/infernyx/tags","blobs_url":"https://api.github.com/repos/tspurway/infernyx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tspurway/infernyx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tspurway/infernyx/git/refs{/sha}","trees_url":"https://api.github.com/repos/tspurway/infernyx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tspurway/infernyx/statuses/{sha}","languages_url":"https://api.github.com/repos/tspurway/infernyx/languages","stargazers_url":"https://api.github.com/repos/tspurway/infernyx/stargazers","contributors_url":"https://api.github.com/repos/tspurway/infernyx/contributors","subscribers_url":"https://api.github.com/repos/tspurway/infernyx/subscribers","subscription_url":"https://api.github.com/repos/tspurway/infernyx/subscription","commits_url":"https://api.github.com/repos/tspurway/infernyx/commits{/sha}","git_commits_url":"https://api.github.com/repos/tspurway/infernyx/git/commits{/sha}","comments_url":"https://api.github.com/repos/tspurway/infernyx/comments{/number}","issue_comment_url":"https://api.github.com/repos/tspurway/infernyx/issues/comments{/number}","contents_url":"https://api.github.com/repos/tspurway/infernyx/contents/{+path}","compare_url":"https://api.github.com/repos/tspurway/infernyx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tspurway/infernyx/merges","archive_url":"https://api.github.com/repos/tspurway/infernyx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tspurway/infernyx/downloads","issues_url":"https://api.github.com/repos/tspurway/infernyx/issues{/number}","pulls_url":"https://api.github.com/repos/tspurway/infernyx/pulls{/number}","milestones_url":"https://api.github.com/repos/tspurway/infernyx/milestones{/number}","notifications_url":"https://api.github.com/repos/tspurway/infernyx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tspurway/infernyx/labels{/name}","releases_url":"https://api.github.com/repos/tspurway/infernyx/releases{/id}","created_at":"2014-08-08T17:18:10Z","updated_at":"2015-04-30T23:42:52Z","pushed_at":"2015-05-07T14:17:40Z","git_url":"git://github.com/tspurway/infernyx.git","ssh_url":"git@github.com:tspurway/infernyx.git","clone_url":"https://github.com/tspurway/infernyx.git","svn_url":"https://github.com/tspurway/infernyx","homepage":null,"size":1723,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"tspurway:master","ref":"master","sha":"c415a1fb7f115fac32d1f03b23e282c9e3fd5f74","user":{"login":"tspurway","id":25276,"avatar_url":"https://avatars.githubusercontent.com/u/25276?v=3","gravatar_id":"","url":"https://api.github.com/users/tspurway","html_url":"https://github.com/tspurway","followers_url":"https://api.github.com/users/tspurway/followers","following_url":"https://api.github.com/users/tspurway/following{/other_user}","gists_url":"https://api.github.com/users/tspurway/gists{/gist_id}","starred_url":"https://api.github.com/users/tspurway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspurway/subscriptions","organizations_url":"https://api.github.com/users/tspurway/orgs","repos_url":"https://api.github.com/users/tspurway/repos","events_url":"https://api.github.com/users/tspurway/events{/privacy}","received_events_url":"https://api.github.com/users/tspurway/received_events","type":"User","site_admin":false},"repo":{"id":22765535,"name":"infernyx","full_name":"tspurway/infernyx","owner":{"login":"tspurway","id":25276,"avatar_url":"https://avatars.githubusercontent.com/u/25276?v=3","gravatar_id":"","url":"https://api.github.com/users/tspurway","html_url":"https://github.com/tspurway","followers_url":"https://api.github.com/users/tspurway/followers","following_url":"https://api.github.com/users/tspurway/following{/other_user}","gists_url":"https://api.github.com/users/tspurway/gists{/gist_id}","starred_url":"https://api.github.com/users/tspurway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspurway/subscriptions","organizations_url":"https://api.github.com/users/tspurway/orgs","repos_url":"https://api.github.com/users/tspurway/repos","events_url":"https://api.github.com/users/tspurway/events{/privacy}","received_events_url":"https://api.github.com/users/tspurway/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tspurway/infernyx","description":"Inferno Rules and Schemas for Tiles project","fork":false,"url":"https://api.github.com/repos/tspurway/infernyx","forks_url":"https://api.github.com/repos/tspurway/infernyx/forks","keys_url":"https://api.github.com/repos/tspurway/infernyx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tspurway/infernyx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tspurway/infernyx/teams","hooks_url":"https://api.github.com/repos/tspurway/infernyx/hooks","issue_events_url":"https://api.github.com/repos/tspurway/infernyx/issues/events{/number}","events_url":"https://api.github.com/repos/tspurway/infernyx/events","assignees_url":"https://api.github.com/repos/tspurway/infernyx/assignees{/user}","branches_url":"https://api.github.com/repos/tspurway/infernyx/branches{/branch}","tags_url":"https://api.github.com/repos/tspurway/infernyx/tags","blobs_url":"https://api.github.com/repos/tspurway/infernyx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tspurway/infernyx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tspurway/infernyx/git/refs{/sha}","trees_url":"https://api.github.com/repos/tspurway/infernyx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tspurway/infernyx/statuses/{sha}","languages_url":"https://api.github.com/repos/tspurway/infernyx/languages","stargazers_url":"https://api.github.com/repos/tspurway/infernyx/stargazers","contributors_url":"https://api.github.com/repos/tspurway/infernyx/contributors","subscribers_url":"https://api.github.com/repos/tspurway/infernyx/subscribers","subscription_url":"https://api.github.com/repos/tspurway/infernyx/subscription","commits_url":"https://api.github.com/repos/tspurway/infernyx/commits{/sha}","git_commits_url":"https://api.github.com/repos/tspurway/infernyx/git/commits{/sha}","comments_url":"https://api.github.com/repos/tspurway/infernyx/comments{/number}","issue_comment_url":"https://api.github.com/repos/tspurway/infernyx/issues/comments{/number}","contents_url":"https://api.github.com/repos/tspurway/infernyx/contents/{+path}","compare_url":"https://api.github.com/repos/tspurway/infernyx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tspurway/infernyx/merges","archive_url":"https://api.github.com/repos/tspurway/infernyx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tspurway/infernyx/downloads","issues_url":"https://api.github.com/repos/tspurway/infernyx/issues{/number}","pulls_url":"https://api.github.com/repos/tspurway/infernyx/pulls{/number}","milestones_url":"https://api.github.com/repos/tspurway/infernyx/milestones{/number}","notifications_url":"https://api.github.com/repos/tspurway/infernyx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tspurway/infernyx/labels{/name}","releases_url":"https://api.github.com/repos/tspurway/infernyx/releases{/id}","created_at":"2014-08-08T17:18:10Z","updated_at":"2015-04-30T23:42:52Z","pushed_at":"2015-05-07T14:17:40Z","git_url":"git://github.com/tspurway/infernyx.git","ssh_url":"git@github.com:tspurway/infernyx.git","clone_url":"https://github.com/tspurway/infernyx.git","svn_url":"https://github.com/tspurway/infernyx","homepage":null,"size":1723,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tspurway/infernyx/pulls/20"},"html":{"href":"https://github.com/tspurway/infernyx/pull/20"},"issue":{"href":"https://api.github.com/repos/tspurway/infernyx/issues/20"},"comments":{"href":"https://api.github.com/repos/tspurway/infernyx/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/tspurway/infernyx/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/tspurway/infernyx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tspurway/infernyx/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/tspurway/infernyx/statuses/04b5b7dbe57020a48f8615cdc9b97c08a7d95461"}}}}