[
https://issues.apache.org/jira/browse/FLINK-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15438868#comment-15438868
]
ASF GitHub Bot commented on FLINK-3950:
---------------------------------------
Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/2374#discussion_r76410073
--- Diff: docs/monitoring/metrics.md ---
@@ -155,6 +155,55 @@ public class MyMapper extends RichMapFunction<Long,
Integer> {
}
{% endhighlight %}
+#### Meter
+
+A `Meter` measures an average throughput. An occurrence of an event can be
registered with the `markEvent()` method. Occurrence of multiple events at the
same time can be registered with `markEvent(long n)` method.
+You can register a meter by calling `meter(String name, Meter histogram)`
on a `MetricGroup`.
+
+{% highlight java %}
+public class MyMapper extends RichMapFunction<Long, Integer> {
+ private Meter meter;
+
+ @Override
+ public void open(Configuration config) {
+ this.meter = getRuntimeContext()
+ .getMetricGroup()
+ .meter("myMeter", new MyMeter());
+ }
+
+ @public Integer map(Long value) throws Exception {
+ this.meter.markEvent();
+ }
+}
+{% endhighlight %}
+
+Flink offers a {% gh_link
flink-metrics/flink-metrics-dropwizard/src/main/java/org/apache/flink/dropwizard/metrics/DropwizardMeterWrapper.java
"Wrapper" %} that allows usage of Codahale/DropWizard meters.
+To use this wrapper add the following dependency in your `pom.xml`:
+{% highlight xml %}
+<dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-metrics-dropwizard</artifactId>
+ <version>{{site.version}}</version>
+</dependency>
+{% endhighlight %}
+
+You can then register a Codahale/DropWizard meter like this:
+
+{% highlight java %}
+public class MyMapper extends RichMapFunction<Long, Integer> {
+ private Meter meter;
+
+ @Override
+ public void open(Configuration config) {
+ com.codahale.metrics.Meter meter = new com.codahale.metrics.Meter();
+
+ this.meter = getRuntimeContext()
+ .getMetricGroup()
+ .histogram("myMeter", new DropWizardMeterWrapper(meter));
--- End diff --
`.histogram` -> `.meter`
> Add Meter Metric Type
> ---------------------
>
> Key: FLINK-3950
> URL: https://issues.apache.org/jira/browse/FLINK-3950
> Project: Flink
> Issue Type: Sub-task
> Components: Core
> Reporter: Stephan Ewen
> Assignee: Ivan Mushketyk
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)