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
    
    
![image](https://cloud.githubusercontent.com/assets/89049/15050706/9ecc6fda-12f5-11e6-8c7d-cc7cb3657ecd.png)



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to