{"action":"created","comment":{"url":"https://api.github.com/repos/groupon/kmond/pulls/comments/55636692","id":55636692,"diff_hunk":"@@ -55,29 +60,50 @@ class GangliaHandler(val vertx: Vertx) : Handler<Message<Metrics>> {\n         get() = vertx.sharedData().getLocalMap<String, GangliaClusterHosts>(\"configs\")?.get(GangliaClusterHostsLoader.NAME)\n \n     override fun handle(msg: Message<Metrics>) {\n+\n         val metrics = msg.body()\n         val hosts = gangliaHostMapping?.getHosts(metrics.cluster) ?: emptySet()\n         val port = gangliaPortMapping?.getPort(metrics.cluster)\n         val packets = createXdrs(metrics)\n \n+        val appMetrics = appMetricsFactory.create()\n+\n         if (port != null && hosts.size > 0) {\n-            hosts.forEach { host ->\n-                packets.forEach { packet ->\n-                    promise<DatagramSocket> {\n-                        thenAsync(SendDatagramPacket(packet.first, host, port))\n-                                .thenAsync(SendDatagramPacket(packet.second, host, port))\n-\n-                        after().thenSync({}, {\n-                                    log.warn(\"send\", \"failure\", arrayOf(\"gangliaPort\", \"gangliaHost\", \"metricsCluster\"),\n-                                            port, host, metrics.cluster, it)\n+            val requestTimer = appMetrics.createTimer(APP_METRICS_PREFIX + \"/request\")\n+            promise<DatagramSocket> {\n+                var packetSizeSum: Long = 0;\n+                hosts.forEach { host ->\n+                    packets.forEach { packet ->\n+                        packetSizeSum += packet.first.length() + packet.second.length()\n+\n+                        async(SendDatagramPacket(packet.first, host, port)) {\n+                            async(SendDatagramPacket(packet.second, host, port)) {\n+                                thenSync({}, {\n+                                    requestTimer.stop()","path":"src/main/kotlin/com/groupon/aint/kmond/output/GangliaHandler.kt","position":69,"original_position":69,"commit_id":"da1c4e6e727290c65c10cd3c10d49753fe4438bd","original_commit_id":"da1c4e6e727290c65c10cd3c10d49753fe4438bd","user":{"login":"vjkoskela","id":1775197,"avatar_url":"https://avatars.githubusercontent.com/u/1775197?v=3","gravatar_id":"","url":"https://api.github.com/users/vjkoskela","html_url":"https://github.com/vjkoskela","followers_url":"https://api.github.com/users/vjkoskela/followers","following_url":"https://api.github.com/users/vjkoskela/following{/other_user}","gists_url":"https://api.github.com/users/vjkoskela/gists{/gist_id}","starred_url":"https://api.github.com/users/vjkoskela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vjkoskela/subscriptions","organizations_url":"https://api.github.com/users/vjkoskela/orgs","repos_url":"https://api.github.com/users/vjkoskela/repos","events_url":"https://api.github.com/users/vjkoskela/events{/privacy}","received_events_url":"https://api.github.com/users/vjkoskela/received_events","type":"User","site_admin":false},"body":"Just to confirm that the thenSync (and nested async) will be executed irregardless of the success/failure of the enclosing block(s).","created_at":"2016-03-10T05:50:40Z","updated_at":"2016-03-10T05:50:40Z","html_url":"https://github.com/groupon/kmond/pull/19#discussion_r55636692","pull_request_url":"https://api.github.com/repos/groupon/kmond/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/groupon/kmond/pulls/comments/55636692"},"html":{"href":"https://github.com/groupon/kmond/pull/19#discussion_r55636692"},"pull_request":{"href":"https://api.github.com/repos/groupon/kmond/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/groupon/kmond/pulls/19","id":61789715,"html_url":"https://github.com/groupon/kmond/pull/19","diff_url":"https://github.com/groupon/kmond/pull/19.diff","patch_url":"https://github.com/groupon/kmond/pull/19.patch","issue_url":"https://api.github.com/repos/groupon/kmond/issues/19","number":19,"state":"open","locked":false,"title":"Add metrics instrumentation to NagiosHandler and GangliaHandler","user":{"login":"matthayter","id":2703760,"avatar_url":"https://avatars.githubusercontent.com/u/2703760?v=3","gravatar_id":"","url":"https://api.github.com/users/matthayter","html_url":"https://github.com/matthayter","followers_url":"https://api.github.com/users/matthayter/followers","following_url":"https://api.github.com/users/matthayter/following{/other_user}","gists_url":"https://api.github.com/users/matthayter/gists{/gist_id}","starred_url":"https://api.github.com/users/matthayter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthayter/subscriptions","organizations_url":"https://api.github.com/users/matthayter/orgs","repos_url":"https://api.github.com/users/matthayter/repos","events_url":"https://api.github.com/users/matthayter/events{/privacy}","received_events_url":"https://api.github.com/users/matthayter/received_events","type":"User","site_admin":false},"body":"* The AINT metrics factory is now shared with vert.x and the global state via the kotlin `object` `AintMetricsFactoryWrapper`","created_at":"2016-03-05T00:00:30Z","updated_at":"2016-03-10T05:50:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6671fa0811c6f5d7d56f0af59798b282bdaa6488","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/groupon/kmond/pulls/19/commits","review_comments_url":"https://api.github.com/repos/groupon/kmond/pulls/19/comments","review_comment_url":"https://api.github.com/repos/groupon/kmond/pulls/comments{/number}","comments_url":"https://api.github.com/repos/groupon/kmond/issues/19/comments","statuses_url":"https://api.github.com/repos/groupon/kmond/statuses/da1c4e6e727290c65c10cd3c10d49753fe4438bd","head":{"label":"groupon:outbound-metrics","ref":"outbound-metrics","sha":"da1c4e6e727290c65c10cd3c10d49753fe4438bd","user":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"repo":{"id":49986044,"name":"kmond","full_name":"groupon/kmond","owner":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupon/kmond","description":"","fork":false,"url":"https://api.github.com/repos/groupon/kmond","forks_url":"https://api.github.com/repos/groupon/kmond/forks","keys_url":"https://api.github.com/repos/groupon/kmond/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupon/kmond/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupon/kmond/teams","hooks_url":"https://api.github.com/repos/groupon/kmond/hooks","issue_events_url":"https://api.github.com/repos/groupon/kmond/issues/events{/number}","events_url":"https://api.github.com/repos/groupon/kmond/events","assignees_url":"https://api.github.com/repos/groupon/kmond/assignees{/user}","branches_url":"https://api.github.com/repos/groupon/kmond/branches{/branch}","tags_url":"https://api.github.com/repos/groupon/kmond/tags","blobs_url":"https://api.github.com/repos/groupon/kmond/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupon/kmond/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupon/kmond/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupon/kmond/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupon/kmond/statuses/{sha}","languages_url":"https://api.github.com/repos/groupon/kmond/languages","stargazers_url":"https://api.github.com/repos/groupon/kmond/stargazers","contributors_url":"https://api.github.com/repos/groupon/kmond/contributors","subscribers_url":"https://api.github.com/repos/groupon/kmond/subscribers","subscription_url":"https://api.github.com/repos/groupon/kmond/subscription","commits_url":"https://api.github.com/repos/groupon/kmond/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupon/kmond/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupon/kmond/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupon/kmond/issues/comments{/number}","contents_url":"https://api.github.com/repos/groupon/kmond/contents/{+path}","compare_url":"https://api.github.com/repos/groupon/kmond/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupon/kmond/merges","archive_url":"https://api.github.com/repos/groupon/kmond/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupon/kmond/downloads","issues_url":"https://api.github.com/repos/groupon/kmond/issues{/number}","pulls_url":"https://api.github.com/repos/groupon/kmond/pulls{/number}","milestones_url":"https://api.github.com/repos/groupon/kmond/milestones{/number}","notifications_url":"https://api.github.com/repos/groupon/kmond/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupon/kmond/labels{/name}","releases_url":"https://api.github.com/repos/groupon/kmond/releases{/id}","deployments_url":"https://api.github.com/repos/groupon/kmond/deployments","created_at":"2016-01-19T21:58:10Z","updated_at":"2016-01-19T23:59:55Z","pushed_at":"2016-03-09T21:30:00Z","git_url":"git://github.com/groupon/kmond.git","ssh_url":"git@github.com:groupon/kmond.git","clone_url":"https://github.com/groupon/kmond.git","svn_url":"https://github.com/groupon/kmond","homepage":null,"size":164,"stargazers_count":0,"watchers_count":0,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"groupon:master","ref":"master","sha":"118c507ac0160c57173970914714f684be29b274","user":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"repo":{"id":49986044,"name":"kmond","full_name":"groupon/kmond","owner":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupon/kmond","description":"","fork":false,"url":"https://api.github.com/repos/groupon/kmond","forks_url":"https://api.github.com/repos/groupon/kmond/forks","keys_url":"https://api.github.com/repos/groupon/kmond/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupon/kmond/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupon/kmond/teams","hooks_url":"https://api.github.com/repos/groupon/kmond/hooks","issue_events_url":"https://api.github.com/repos/groupon/kmond/issues/events{/number}","events_url":"https://api.github.com/repos/groupon/kmond/events","assignees_url":"https://api.github.com/repos/groupon/kmond/assignees{/user}","branches_url":"https://api.github.com/repos/groupon/kmond/branches{/branch}","tags_url":"https://api.github.com/repos/groupon/kmond/tags","blobs_url":"https://api.github.com/repos/groupon/kmond/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupon/kmond/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupon/kmond/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupon/kmond/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupon/kmond/statuses/{sha}","languages_url":"https://api.github.com/repos/groupon/kmond/languages","stargazers_url":"https://api.github.com/repos/groupon/kmond/stargazers","contributors_url":"https://api.github.com/repos/groupon/kmond/contributors","subscribers_url":"https://api.github.com/repos/groupon/kmond/subscribers","subscription_url":"https://api.github.com/repos/groupon/kmond/subscription","commits_url":"https://api.github.com/repos/groupon/kmond/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupon/kmond/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupon/kmond/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupon/kmond/issues/comments{/number}","contents_url":"https://api.github.com/repos/groupon/kmond/contents/{+path}","compare_url":"https://api.github.com/repos/groupon/kmond/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupon/kmond/merges","archive_url":"https://api.github.com/repos/groupon/kmond/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupon/kmond/downloads","issues_url":"https://api.github.com/repos/groupon/kmond/issues{/number}","pulls_url":"https://api.github.com/repos/groupon/kmond/pulls{/number}","milestones_url":"https://api.github.com/repos/groupon/kmond/milestones{/number}","notifications_url":"https://api.github.com/repos/groupon/kmond/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupon/kmond/labels{/name}","releases_url":"https://api.github.com/repos/groupon/kmond/releases{/id}","deployments_url":"https://api.github.com/repos/groupon/kmond/deployments","created_at":"2016-01-19T21:58:10Z","updated_at":"2016-01-19T23:59:55Z","pushed_at":"2016-03-09T21:30:00Z","git_url":"git://github.com/groupon/kmond.git","ssh_url":"git@github.com:groupon/kmond.git","clone_url":"https://github.com/groupon/kmond.git","svn_url":"https://github.com/groupon/kmond","homepage":null,"size":164,"stargazers_count":0,"watchers_count":0,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/groupon/kmond/pulls/19"},"html":{"href":"https://github.com/groupon/kmond/pull/19"},"issue":{"href":"https://api.github.com/repos/groupon/kmond/issues/19"},"comments":{"href":"https://api.github.com/repos/groupon/kmond/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/groupon/kmond/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/groupon/kmond/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/groupon/kmond/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/groupon/kmond/statuses/da1c4e6e727290c65c10cd3c10d49753fe4438bd"}}}}