You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (JIRA)" <ji...@apache.org> on 2019/07/31 12:44:00 UTC
[jira] [Closed] (FLINK-13496) Correct the documentation of Gauge
metric initialization
[ https://issues.apache.org/jira/browse/FLINK-13496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chesnay Schepler closed FLINK-13496.
------------------------------------
Resolution: Not A Problem
Fix Version/s: (was: 1.10)
(was: 1.9.0)
{{valueToExpose}} cannot be null since it is a primitive, which retain their original value during serialization.
> 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
>
> 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)