{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/riptide/pulls/comments/146771865","pull_request_review_id":71760780,"id":146771865,"diff_hunk":"@@ -0,0 +1,57 @@\n+package org.zalando.riptide.metrics;\n+\n+import com.google.common.base.Stopwatch;\n+import lombok.AllArgsConstructor;\n+import org.springframework.boot.actuate.metrics.GaugeService;\n+import org.springframework.http.client.ClientHttpResponse;\n+import org.zalando.riptide.Plugin;\n+import org.zalando.riptide.RequestArguments;\n+import org.zalando.riptide.RequestExecution;\n+\n+import javax.annotation.Nullable;\n+import java.util.concurrent.TimeUnit;\n+\n+import static org.zalando.fauxpas.FauxPas.throwingBiConsumer;\n+\n+public final class MetricsPlugin implements Plugin {\n+\n+    private final GaugeService gaugeService;\n+    private final MetricsNameGenerator generator;\n+\n+    public MetricsPlugin(final GaugeService gaugeService, final MetricsNameGenerator generator) {\n+        this.gaugeService = gaugeService;\n+        this.generator = generator;\n+    }\n+\n+    @Override\n+    public RequestExecution interceptBeforeRouting(final RequestArguments arguments, final RequestExecution execution) {\n+        final Metric metric = new Metric(arguments);\n+\n+        return () -> execution.execute()\n+                .whenComplete(throwingBiConsumer(metric::record));\n+    }\n+\n+    @Override\n+    public RequestExecution prepare(final RequestArguments arguments, final RequestExecution execution) {\n+        return execution;\n+    }\n+\n+    @AllArgsConstructor\n+    private final class Metric {","path":"riptide-metrics/src/main/java/org/zalando/riptide/metrics/MetricsPlugin.java","position":40,"original_position":40,"commit_id":"9dac92ed85717cd86ac49c06d51b103248de2b33","original_commit_id":"9dac92ed85717cd86ac49c06d51b103248de2b33","user":{"login":"lukasniemeier-zalando","id":10497901,"avatar_url":"https://avatars0.githubusercontent.com/u/10497901?v=4","gravatar_id":"","url":"https://api.github.com/users/lukasniemeier-zalando","html_url":"https://github.com/lukasniemeier-zalando","followers_url":"https://api.github.com/users/lukasniemeier-zalando/followers","following_url":"https://api.github.com/users/lukasniemeier-zalando/following{/other_user}","gists_url":"https://api.github.com/users/lukasniemeier-zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasniemeier-zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasniemeier-zalando/subscriptions","organizations_url":"https://api.github.com/users/lukasniemeier-zalando/orgs","repos_url":"https://api.github.com/users/lukasniemeier-zalando/repos","events_url":"https://api.github.com/users/lukasniemeier-zalando/events{/privacy}","received_events_url":"https://api.github.com/users/lukasniemeier-zalando/received_events","type":"User","site_admin":false},"body":"`measurement` since we are *measuring* a *metric* in this class. ","created_at":"2017-10-25T07:18:47Z","updated_at":"2017-10-25T07:18:47Z","html_url":"https://github.com/zalando/riptide/pull/269#discussion_r146771865","pull_request_url":"https://api.github.com/repos/zalando/riptide/pulls/269","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/zalando/riptide/pulls/comments/146771865"},"html":{"href":"https://github.com/zalando/riptide/pull/269#discussion_r146771865"},"pull_request":{"href":"https://api.github.com/repos/zalando/riptide/pulls/269"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/riptide/pulls/269","id":148434933,"html_url":"https://github.com/zalando/riptide/pull/269","diff_url":"https://github.com/zalando/riptide/pull/269.diff","patch_url":"https://github.com/zalando/riptide/pull/269.patch","issue_url":"https://api.github.com/repos/zalando/riptide/issues/269","number":269,"state":"closed","locked":false,"title":"Added metrics plugin","user":{"login":"whiskeysierra","id":429981,"avatar_url":"https://avatars2.githubusercontent.com/u/429981?v=4","gravatar_id":"","url":"https://api.github.com/users/whiskeysierra","html_url":"https://github.com/whiskeysierra","followers_url":"https://api.github.com/users/whiskeysierra/followers","following_url":"https://api.github.com/users/whiskeysierra/following{/other_user}","gists_url":"https://api.github.com/users/whiskeysierra/gists{/gist_id}","starred_url":"https://api.github.com/users/whiskeysierra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whiskeysierra/subscriptions","organizations_url":"https://api.github.com/users/whiskeysierra/orgs","repos_url":"https://api.github.com/users/whiskeysierra/repos","events_url":"https://api.github.com/users/whiskeysierra/events{/privacy}","received_events_url":"https://api.github.com/users/whiskeysierra/received_events","type":"User","site_admin":false},"body":"Fixes #256\r\n\r\n- [x] riptide-metrics: README\r\n- [x] Document new Plugin API in README\r\n- [x] Document new configuration in starter\r\n- [x] Link to plugin","created_at":"2017-10-24T15:38:26Z","updated_at":"2017-10-25T07:18:47Z","closed_at":"2017-10-24T16:35:18Z","merged_at":"2017-10-24T16:35:18Z","merge_commit_sha":"c9df2f9705a75e4919a2f3dc08ce6a6860ca4ac7","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/zalando/riptide/pulls/269/commits","review_comments_url":"https://api.github.com/repos/zalando/riptide/pulls/269/comments","review_comment_url":"https://api.github.com/repos/zalando/riptide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/riptide/issues/269/comments","statuses_url":"https://api.github.com/repos/zalando/riptide/statuses/9dac92ed85717cd86ac49c06d51b103248de2b33","head":{"label":"zalando:feature/metrics","ref":"feature/metrics","sha":"9dac92ed85717cd86ac49c06d51b103248de2b33","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars0.githubusercontent.com/u/1564818?v=4","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":33559545,"name":"riptide","full_name":"zalando/riptide","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars0.githubusercontent.com/u/1564818?v=4","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/riptide","description":"Client-side response routing","fork":false,"url":"https://api.github.com/repos/zalando/riptide","forks_url":"https://api.github.com/repos/zalando/riptide/forks","keys_url":"https://api.github.com/repos/zalando/riptide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/riptide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/riptide/teams","hooks_url":"https://api.github.com/repos/zalando/riptide/hooks","issue_events_url":"https://api.github.com/repos/zalando/riptide/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/riptide/events","assignees_url":"https://api.github.com/repos/zalando/riptide/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/riptide/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/riptide/tags","blobs_url":"https://api.github.com/repos/zalando/riptide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/riptide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/riptide/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/riptide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/riptide/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/riptide/languages","stargazers_url":"https://api.github.com/repos/zalando/riptide/stargazers","contributors_url":"https://api.github.com/repos/zalando/riptide/contributors","subscribers_url":"https://api.github.com/repos/zalando/riptide/subscribers","subscription_url":"https://api.github.com/repos/zalando/riptide/subscription","commits_url":"https://api.github.com/repos/zalando/riptide/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/riptide/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/riptide/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/riptide/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/riptide/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/riptide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/riptide/merges","archive_url":"https://api.github.com/repos/zalando/riptide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/riptide/downloads","issues_url":"https://api.github.com/repos/zalando/riptide/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/riptide/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/riptide/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/riptide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/riptide/labels{/name}","releases_url":"https://api.github.com/repos/zalando/riptide/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/riptide/deployments","created_at":"2015-04-07T18:03:31Z","updated_at":"2017-10-17T11:36:04Z","pushed_at":"2017-10-24T16:35:30Z","git_url":"git://github.com/zalando/riptide.git","ssh_url":"git@github.com:zalando/riptide.git","clone_url":"https://github.com/zalando/riptide.git","svn_url":"https://github.com/zalando/riptide","homepage":"","size":2907,"stargazers_count":43,"watchers_count":43,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":11,"forks":6,"open_issues":11,"watchers":43,"default_branch":"master"}},"base":{"label":"zalando:master","ref":"master","sha":"d61d8677c86f463fabb1ffdfa668fd0bbfe11868","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars0.githubusercontent.com/u/1564818?v=4","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":33559545,"name":"riptide","full_name":"zalando/riptide","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars0.githubusercontent.com/u/1564818?v=4","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/riptide","description":"Client-side response routing","fork":false,"url":"https://api.github.com/repos/zalando/riptide","forks_url":"https://api.github.com/repos/zalando/riptide/forks","keys_url":"https://api.github.com/repos/zalando/riptide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/riptide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/riptide/teams","hooks_url":"https://api.github.com/repos/zalando/riptide/hooks","issue_events_url":"https://api.github.com/repos/zalando/riptide/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/riptide/events","assignees_url":"https://api.github.com/repos/zalando/riptide/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/riptide/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/riptide/tags","blobs_url":"https://api.github.com/repos/zalando/riptide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/riptide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/riptide/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/riptide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/riptide/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/riptide/languages","stargazers_url":"https://api.github.com/repos/zalando/riptide/stargazers","contributors_url":"https://api.github.com/repos/zalando/riptide/contributors","subscribers_url":"https://api.github.com/repos/zalando/riptide/subscribers","subscription_url":"https://api.github.com/repos/zalando/riptide/subscription","commits_url":"https://api.github.com/repos/zalando/riptide/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/riptide/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/riptide/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/riptide/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/riptide/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/riptide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/riptide/merges","archive_url":"https://api.github.com/repos/zalando/riptide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/riptide/downloads","issues_url":"https://api.github.com/repos/zalando/riptide/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/riptide/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/riptide/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/riptide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/riptide/labels{/name}","releases_url":"https://api.github.com/repos/zalando/riptide/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/riptide/deployments","created_at":"2015-04-07T18:03:31Z","updated_at":"2017-10-17T11:36:04Z","pushed_at":"2017-10-24T16:35:30Z","git_url":"git://github.com/zalando/riptide.git","ssh_url":"git@github.com:zalando/riptide.git","clone_url":"https://github.com/zalando/riptide.git","svn_url":"https://github.com/zalando/riptide","homepage":"","size":2907,"stargazers_count":43,"watchers_count":43,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":11,"forks":6,"open_issues":11,"watchers":43,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/riptide/pulls/269"},"html":{"href":"https://github.com/zalando/riptide/pull/269"},"issue":{"href":"https://api.github.com/repos/zalando/riptide/issues/269"},"comments":{"href":"https://api.github.com/repos/zalando/riptide/issues/269/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/riptide/pulls/269/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/riptide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/riptide/pulls/269/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/riptide/statuses/9dac92ed85717cd86ac49c06d51b103248de2b33"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"lukasniemeier-zalando"}}