{"action":"created","comment":{"url":"https://api.github.com/repos/apache/flink/pulls/comments/68196408","id":68196408,"diff_hunk":"@@ -0,0 +1,135 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.apache.flink.metrics;\n+\n+import org.apache.flink.annotation.PublicEvolving;\n+\n+/**\n+ * Histogram statistics represent the current snapshot of elements recorded in the histogram.\n+ *\n+ * The histogram statistics allow to calculate values for quantiles, the mean, the standard\n+ * deviation, the minimum and the maximum.\n+ */\n+@PublicEvolving\n+public abstract class HistogramStatistics {\n+\n+\t/**\n+\t * Returns the value for the given quantile based on the represented histogram statistics.\n+\t *\n+\t * @param quantile Quantile to calculate the value for\n+\t * @return Value for the given quantile\n+\t */\n+\tpublic abstract double getValue(double quantile);\n+\n+\t/**\n+\t * Returns the elements of the statistics' sample\n+\t *\n+\t * @return Elements of the statistics' sample\n+\t */\n+\tpublic abstract long[] getValues();\n+\n+\t/**\n+\t * Returns the size of the statistics' sample\n+\t *\n+\t * @return Size of the statistics' sample\n+\t */\n+\tpublic abstract int size();\n+\n+\t/**\n+\t * Returns the mean of the histogram values.\n+\t *\n+\t * @return Mean of the histogram values\n+\t */\n+\tpublic abstract double getMean();\n+\n+\t/**\n+\t * Returns the standard deviation of the distribution reflected by the histogram statistics.\n+\t *\n+\t * @return Standard deviation of histogram distribution\n+\t */\n+\tpublic abstract double getStdDev();\n+\n+\t/**\n+\t * Returns the maximum value of the histogram.\n+\t *\n+\t * @return Maximum value of the histogram\n+\t */\n+\tpublic abstract long getMax();\n+\n+\t/**\n+\t * Returns the minimum value of the histogram.\n+\t *\n+\t * @return Minimum value of the histogram\n+\t */\n+\tpublic abstract long getMin();\n+\n+\t/**\n+\t * Returns the 50th percentile.\n+\t *\n+\t * @return 50th percentile\n+\t */\n+\tpublic double getMedian() {\n+\t\treturn getValue(0.5);\n+\t}\n+\n+\t/**\n+\t * Returns the 75th percentile.\n+\t *\n+\t * @return 75th percentile\n+\t */\n+\tpublic double get75thPercentile() {\n+\t\treturn getValue(0.75);\n+\t}\n+\n+\t/**\n+\t * Returns the 95th percentile.\n+\t *\n+\t * @return 95th percentile\n+\t */\n+\tpublic double get95thPercentile() {\n+\t\treturn getValue(0.95);\n+\t}\n+\n+\t/**\n+\t * Returns the 98th percentile.\n+\t *\n+\t * @return 98th percentile\n+\t */\n+\tpublic double get98thPercentile() {\n+\t\treturn getValue(0.98);\n+\t}\n+\n+\t/**\n+\t * Returns the 99th percentile.\n+\t *\n+\t * @return 99th percentile\n+\t */\n+\tpublic double get99thPercentile() {","path":"flink-core/src/main/java/org/apache/flink/metrics/HistogramStatistics.java","position":123,"original_position":123,"commit_id":"6db2e62c000eccd04cc6481b0019bae0b2cb679a","original_commit_id":"832b83c90a03d9f358ed234ebfe730c83a45a41b","user":{"login":"tillrohrmann","id":5756858,"avatar_url":"https://avatars.githubusercontent.com/u/5756858?v=3","gravatar_id":"","url":"https://api.github.com/users/tillrohrmann","html_url":"https://github.com/tillrohrmann","followers_url":"https://api.github.com/users/tillrohrmann/followers","following_url":"https://api.github.com/users/tillrohrmann/following{/other_user}","gists_url":"https://api.github.com/users/tillrohrmann/gists{/gist_id}","starred_url":"https://api.github.com/users/tillrohrmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillrohrmann/subscriptions","organizations_url":"https://api.github.com/users/tillrohrmann/orgs","repos_url":"https://api.github.com/users/tillrohrmann/repos","events_url":"https://api.github.com/users/tillrohrmann/events{/privacy}","received_events_url":"https://api.github.com/users/tillrohrmann/received_events","type":"User","site_admin":false},"body":"Alright then I'll remove all extra methods except for `getValue==getQuantile`.","created_at":"2016-06-23T08:42:45Z","updated_at":"2016-06-23T08:42:45Z","html_url":"https://github.com/apache/flink/pull/2112#discussion_r68196408","pull_request_url":"https://api.github.com/repos/apache/flink/pulls/2112","_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/comments/68196408"},"html":{"href":"https://github.com/apache/flink/pull/2112#discussion_r68196408"},"pull_request":{"href":"https://api.github.com/repos/apache/flink/pulls/2112"}}},"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/2112","id":74057036,"html_url":"https://github.com/apache/flink/pull/2112","diff_url":"https://github.com/apache/flink/pull/2112.diff","patch_url":"https://github.com/apache/flink/pull/2112.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/2112","number":2112,"state":"open","locked":false,"title":"[FLINK-3951] Add histogram metric type","user":{"login":"tillrohrmann","id":5756858,"avatar_url":"https://avatars.githubusercontent.com/u/5756858?v=3","gravatar_id":"","url":"https://api.github.com/users/tillrohrmann","html_url":"https://github.com/tillrohrmann","followers_url":"https://api.github.com/users/tillrohrmann/followers","following_url":"https://api.github.com/users/tillrohrmann/following{/other_user}","gists_url":"https://api.github.com/users/tillrohrmann/gists{/gist_id}","starred_url":"https://api.github.com/users/tillrohrmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillrohrmann/subscriptions","organizations_url":"https://api.github.com/users/tillrohrmann/orgs","repos_url":"https://api.github.com/users/tillrohrmann/repos","events_url":"https://api.github.com/users/tillrohrmann/events{/privacy}","received_events_url":"https://api.github.com/users/tillrohrmann/received_events","type":"User","site_admin":false},"body":"This PR introduces an interface for Flink's histogram metric type `Histogram` and the corresponding statistics `HistogramStatistics`. The `Histogram` interface allows to update the histogram with new values , retrieve the number of collected values and to obtain a `HistogramStatistics` object which represents the current statistics of the histogram. The values must be of type long.\r\n\r\nThe `HistogramStatistics` allows to compute the mean, min, max and values for quantiles based on the element distribution calculated by the histogram.\r\n\r\nAn implementation of the `Histogram` interface is contained in the flink-metrics-dropwizard module. The implementation wraps a dropwizard histogram via the `DropwizardHistogramWrapper` class. This is currently the only implementation of `Histogram`. If needed, we can add a histogram implementation to flink-core later. But for the moment histograms are intended to be used as user metrics. Histograms add computational overhead which should not be imposed on the runtime per default.\r\n\r\nThe histogram' statistics are reported by all currently supported `MetricReporters`. The `JMXReporter` introduces a `JmxHistogramMBean` interface for this purpose. The `StatsDReporter` reports the individual values of the `HistogramStatistics` object as gauge values. The `ScheduledDropwizardReporter` wraps the `Histogram` in a `HistogramWrapper` and the `HistogramStatistics` in a `HistogramStatisticsWrapper` so that they can be given to Dropwizards' own reporters. As an optimization, the `ScheduledDropwizardReporter` detects a `DropwizardHistogramWrapper` and unwraps the dropwizard histogram which is then used for reporting.","created_at":"2016-06-16T10:28:47Z","updated_at":"2016-06-23T08:42:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df58c8656abcb6109927f501d16eaacb5b9d2b99","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/2112/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/2112/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/2112/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/6db2e62c000eccd04cc6481b0019bae0b2cb679a","head":{"label":"tillrohrmann:addHistogram","ref":"addHistogram","sha":"6db2e62c000eccd04cc6481b0019bae0b2cb679a","user":{"login":"tillrohrmann","id":5756858,"avatar_url":"https://avatars.githubusercontent.com/u/5756858?v=3","gravatar_id":"","url":"https://api.github.com/users/tillrohrmann","html_url":"https://github.com/tillrohrmann","followers_url":"https://api.github.com/users/tillrohrmann/followers","following_url":"https://api.github.com/users/tillrohrmann/following{/other_user}","gists_url":"https://api.github.com/users/tillrohrmann/gists{/gist_id}","starred_url":"https://api.github.com/users/tillrohrmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillrohrmann/subscriptions","organizations_url":"https://api.github.com/users/tillrohrmann/orgs","repos_url":"https://api.github.com/users/tillrohrmann/repos","events_url":"https://api.github.com/users/tillrohrmann/events{/privacy}","received_events_url":"https://api.github.com/users/tillrohrmann/received_events","type":"User","site_admin":false},"repo":{"id":20681108,"name":"flink","full_name":"tillrohrmann/flink","owner":{"login":"tillrohrmann","id":5756858,"avatar_url":"https://avatars.githubusercontent.com/u/5756858?v=3","gravatar_id":"","url":"https://api.github.com/users/tillrohrmann","html_url":"https://github.com/tillrohrmann","followers_url":"https://api.github.com/users/tillrohrmann/followers","following_url":"https://api.github.com/users/tillrohrmann/following{/other_user}","gists_url":"https://api.github.com/users/tillrohrmann/gists{/gist_id}","starred_url":"https://api.github.com/users/tillrohrmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillrohrmann/subscriptions","organizations_url":"https://api.github.com/users/tillrohrmann/orgs","repos_url":"https://api.github.com/users/tillrohrmann/repos","events_url":"https://api.github.com/users/tillrohrmann/events{/privacy}","received_events_url":"https://api.github.com/users/tillrohrmann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tillrohrmann/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/tillrohrmann/flink","forks_url":"https://api.github.com/repos/tillrohrmann/flink/forks","keys_url":"https://api.github.com/repos/tillrohrmann/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tillrohrmann/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tillrohrmann/flink/teams","hooks_url":"https://api.github.com/repos/tillrohrmann/flink/hooks","issue_events_url":"https://api.github.com/repos/tillrohrmann/flink/issues/events{/number}","events_url":"https://api.github.com/repos/tillrohrmann/flink/events","assignees_url":"https://api.github.com/repos/tillrohrmann/flink/assignees{/user}","branches_url":"https://api.github.com/repos/tillrohrmann/flink/branches{/branch}","tags_url":"https://api.github.com/repos/tillrohrmann/flink/tags","blobs_url":"https://api.github.com/repos/tillrohrmann/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tillrohrmann/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tillrohrmann/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/tillrohrmann/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tillrohrmann/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/tillrohrmann/flink/languages","stargazers_url":"https://api.github.com/repos/tillrohrmann/flink/stargazers","contributors_url":"https://api.github.com/repos/tillrohrmann/flink/contributors","subscribers_url":"https://api.github.com/repos/tillrohrmann/flink/subscribers","subscription_url":"https://api.github.com/repos/tillrohrmann/flink/subscription","commits_url":"https://api.github.com/repos/tillrohrmann/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/tillrohrmann/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/tillrohrmann/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/tillrohrmann/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/tillrohrmann/flink/contents/{+path}","compare_url":"https://api.github.com/repos/tillrohrmann/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tillrohrmann/flink/merges","archive_url":"https://api.github.com/repos/tillrohrmann/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tillrohrmann/flink/downloads","issues_url":"https://api.github.com/repos/tillrohrmann/flink/issues{/number}","pulls_url":"https://api.github.com/repos/tillrohrmann/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/tillrohrmann/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/tillrohrmann/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tillrohrmann/flink/labels{/name}","releases_url":"https://api.github.com/repos/tillrohrmann/flink/releases{/id}","deployments_url":"https://api.github.com/repos/tillrohrmann/flink/deployments","created_at":"2014-06-10T10:19:35Z","updated_at":"2016-05-12T12:46:07Z","pushed_at":"2016-06-22T08:58:45Z","git_url":"git://github.com/tillrohrmann/flink.git","ssh_url":"git@github.com:tillrohrmann/flink.git","clone_url":"https://github.com/tillrohrmann/flink.git","svn_url":"https://github.com/tillrohrmann/flink","homepage":null,"size":89842,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"10495852370fed3b7683d428f6c2cc7470b3d8ed","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":20587599,"name":"flink","full_name":"apache/flink","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/flink","description":"Mirror of Apache Flink","fork":false,"url":"https://api.github.com/repos/apache/flink","forks_url":"https://api.github.com/repos/apache/flink/forks","keys_url":"https://api.github.com/repos/apache/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/flink/teams","hooks_url":"https://api.github.com/repos/apache/flink/hooks","issue_events_url":"https://api.github.com/repos/apache/flink/issues/events{/number}","events_url":"https://api.github.com/repos/apache/flink/events","assignees_url":"https://api.github.com/repos/apache/flink/assignees{/user}","branches_url":"https://api.github.com/repos/apache/flink/branches{/branch}","tags_url":"https://api.github.com/repos/apache/flink/tags","blobs_url":"https://api.github.com/repos/apache/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/flink/languages","stargazers_url":"https://api.github.com/repos/apache/flink/stargazers","contributors_url":"https://api.github.com/repos/apache/flink/contributors","subscribers_url":"https://api.github.com/repos/apache/flink/subscribers","subscription_url":"https://api.github.com/repos/apache/flink/subscription","commits_url":"https://api.github.com/repos/apache/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/flink/contents/{+path}","compare_url":"https://api.github.com/repos/apache/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/flink/merges","archive_url":"https://api.github.com/repos/apache/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/flink/downloads","issues_url":"https://api.github.com/repos/apache/flink/issues{/number}","pulls_url":"https://api.github.com/repos/apache/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/flink/labels{/name}","releases_url":"https://api.github.com/repos/apache/flink/releases{/id}","deployments_url":"https://api.github.com/repos/apache/flink/deployments","created_at":"2014-06-07T07:00:10Z","updated_at":"2016-06-22T17:59:37Z","pushed_at":"2016-06-23T08:17:39Z","git_url":"git://github.com/apache/flink.git","ssh_url":"git@github.com:apache/flink.git","clone_url":"https://github.com/apache/flink.git","svn_url":"https://github.com/apache/flink","homepage":null,"size":119920,"stargazers_count":1381,"watchers_count":1381,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":891,"mirror_url":"git://git.apache.org/flink.git","open_issues_count":113,"forks":891,"open_issues":113,"watchers":1381,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/2112"},"html":{"href":"https://github.com/apache/flink/pull/2112"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/2112"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/2112/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/2112/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/2112/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/6db2e62c000eccd04cc6481b0019bae0b2cb679a"}}}}
{"actor":{"display_login":"tillrohrmann"}}