You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Yun Tang (JIRA)" <ji...@apache.org> on 2019/07/30 10:15:00 UTC

[jira] [Commented] (FLINK-13496) Correct the documentation of Gauge metric initialization

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

Yun Tang commented on FLINK-13496:
----------------------------------

I prefer to fix this before Flink-1.9 release, so that user would not be misled. [~Zentol] would you please assign this ticket to me?

> Correct the documentation of Gauge metric initialization
> --------------------------------------------------------
>
>                 Key: FLINK-13496
>                 URL: https://issues.apache.org/jira/browse/FLINK-13496
>             Project: Flink
>          Issue Type: Bug
>          Components: Documentation
>            Reporter: Yun Tang
>            Priority: Major
>             Fix For: 1.9.0, 1.10
>
>
> Current documentation of [Gauge|https://ci.apache.org/projects/flink/flink-docs-stable/monitoring/metrics.html#gauge] set the value to expose as {{transient}}. 
> {code:java}
> public class MyMapper extends RichMapFunction<String, String> {
>   private transient int valueToExpose = 0;
>   @Override
>   public void open(Configuration config) {
>     getRuntimeContext()
>       .getMetricGroup()
>       .gauge("MyGauge", new Gauge<Integer>() {
>         @Override
>         public Integer getValue() {
>           return valueToExpose;
>         }
>       });
>   }
>   @Override
>   public String map(String value) throws Exception {
>     valueToExpose++;
>     return value;
>   }
> }
> {code}
> However, this would let the initialization value {{valueToExpose}} within {{MyGauge}} as null on task manager side. This would actually mislead users who want to add customized gauge.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)