From issues-return-173641-archive-asf-public=cust-asf.ponee.io@flink.apache.org Wed Jun 27 13:33:28 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2B9A1180625 for ; Wed, 27 Jun 2018 13:33:27 +0200 (CEST) Received: (qmail 49490 invoked by uid 500); 27 Jun 2018 11:33:27 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 49481 invoked by uid 99); 27 Jun 2018 11:33:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jun 2018 11:33:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 03898DFC7B; Wed, 27 Jun 2018 11:33:27 +0000 (UTC) From: zentol To: issues@flink.apache.org Reply-To: issues@flink.apache.org References: In-Reply-To: Subject: [GitHub] flink pull request #6211: [FLINK-9665] PrometheusReporter does not properly ... Content-Type: text/plain Message-Id: <20180627113327.03898DFC7B@git1-us-west.apache.org> Date: Wed, 27 Jun 2018 11:33:27 +0000 (UTC) Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/6211#discussion_r198460116 --- Diff: flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java --- @@ -159,6 +162,27 @@ public void histogramIsReportedAsPrometheusSummary() throws UnirestException { } } + @Test + public void metricIsRemovedWhenCollectorIsNotUnregisteredYet() throws UnirestException { + TaskManagerMetricGroup tmMetricGroup = new TaskManagerMetricGroup(registry, HOST_NAME, TASK_MANAGER); + + String metricName = "numRecordsOut"; + + Counter metric1 = new SimpleCounter(); + FrontMetricGroup metricGroup1 = new FrontMetricGroup<>(1, new TaskManagerJobMetricGroup(registry, tmMetricGroup, JobID.generate(), "job_1")); + reporter.notifyOfAddedMetric(metric1, metricName, metricGroup1); + + Counter metric2 = new SimpleCounter(); + FrontMetricGroup metricGroup2 = new FrontMetricGroup<>(2, new TaskManagerJobMetricGroup(registry, tmMetricGroup, JobID.generate(), "job_2")); --- End diff -- nit: the first argument to `FrontMetricGroup` should be identical since you're passing it to the same reporter. Actually it shouldn't be necessary to create a `FrontMetricGroup` at all, as it is only need to introduce reporter specific configuration properties. ---