[ 
https://issues.apache.org/jira/browse/FLINK-2720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15953312#comment-15953312
 ] 

ASF GitHub Bot commented on FLINK-2720:
---------------------------------------

Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3615#discussion_r109393713
  
    --- Diff: 
flink-contrib/flink-storm/src/main/java/org/apache/flink/storm/metric/CounterMetricAdapter.java
 ---
    @@ -0,0 +1,94 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.flink.storm.metric;
    +
    +import org.apache.flink.metrics.Counter;
    +import org.apache.flink.metrics.Metric;
    +
    +import backtype.storm.metric.api.CountMetric;
    +import backtype.storm.metric.api.IMetric;
    +
    +/**
    + * An adapter to compose the counter metric between flink counter and 
storm counter metric.
    + * 
    + * @since Mar 5, 2017
    + *
    + */
    +public class CounterMetricAdapter extends CountMetric implements IMetric, 
Counter, IMetricAdapter<CountMetric> {
    +
    +    /** the current count */
    +    // private long count;
    +
    +    private Counter delegate;
    +
    +    public CounterMetricAdapter(Counter counter) {
    +        this.delegate = counter;
    +    }
    +
    +    // /Overide of storm CountMetric method to rely on current field 
'count' instead of '_value' in parent class.///
    +
    +    public void incr() {
    +        delegate.inc();
    +    }
    +
    +    public void incrBy(long incrementBy) {
    +        delegate.inc(incrementBy);
    +    }
    +
    +    public Object getValueAndReset() {
    --- End diff --
    
    Why does this return Object and not long?


> Add Storm-CountMetric in flink-stormcompatibility
> -------------------------------------------------
>
>                 Key: FLINK-2720
>                 URL: https://issues.apache.org/jira/browse/FLINK-2720
>             Project: Flink
>          Issue Type: New Feature
>          Components: Storm Compatibility
>            Reporter: Huang Wei
>            Assignee: Matthias J. Sax
>             Fix For: 1.0.0
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Add the CountMetric for the first step of storm metrics:
> 1.Do a wrapper FlinkCountMetric for CountMetric
> 2.push the RuntimeContext in FlinkTopologyContext to use `addAccumulator` 
> method for registering the metric.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to