[
https://issues.apache.org/jira/browse/FLINK-1502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15272662#comment-15272662
]
ASF GitHub Bot commented on FLINK-1502:
---------------------------------------
Github user rmetzger commented on the pull request:
https://github.com/apache/flink/pull/1947#issuecomment-217214295
I'm just assuming its the missing "close()" call's I've commented already
causing this issue.
I just tried adding some custom metrics:
```java
new RichFlatMapFunction<String, WordWithCount>() {
public Counter output;
public Counter el;
public String lastOut;
@Override
public void open(Configuration
parameters) throws Exception {
super.open(parameters);
MetricGroup mg =
getRuntimeContext().getMetricGroup();
this.el =
mg.counter("elements");
MetricGroup detailedGroup =
mg.addGroup("detailed");
this.output =
detailedGroup.counter("output");
detailedGroup.gauge("lastOut",
new Gauge<String>() {
@Override
public String
getValue() {
return lastOut;
}
});
}
@Override
public void flatMap(String value,
Collector<WordWithCount> out) {
el.inc();
for (String word :
value.split("\\s")) {
lastOut = word;
out.collect(new
WordWithCount(word, 1L));
output.inc();
}
}
}
```
and it works amazingly well

> Expose metrics to graphite, ganglia and JMX.
> --------------------------------------------
>
> Key: FLINK-1502
> URL: https://issues.apache.org/jira/browse/FLINK-1502
> Project: Flink
> Issue Type: Sub-task
> Components: JobManager, TaskManager
> Affects Versions: 0.9
> Reporter: Robert Metzger
> Assignee: Chesnay Schepler
> Priority: Minor
> Fix For: pre-apache
>
>
> The metrics library allows to expose collected metrics easily to other
> systems such as graphite, ganglia or Java's JVM (VisualVM).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)