use of org.apache.flink.runtime.metrics.groups.JobManagerJobMetricGroup in project flink by apache.
the class PrometheusReporterTest method metricIsRemovedWhenCollectorIsNotUnregisteredYet.
@Test
void metricIsRemovedWhenCollectorIsNotUnregisteredYet() throws UnirestException {
JobManagerMetricGroup jmMetricGroup = JobManagerMetricGroup.createJobManagerMetricGroup(registry, HOST_NAME);
String metricName = "metric";
Counter metric1 = new SimpleCounter();
FrontMetricGroup<JobManagerJobMetricGroup> metricGroup1 = new FrontMetricGroup<>(createReporterScopedSettings(), jmMetricGroup.addJob(JobID.generate(), "job_1"));
reporter.notifyOfAddedMetric(metric1, metricName, metricGroup1);
Counter metric2 = new SimpleCounter();
FrontMetricGroup<JobManagerJobMetricGroup> metricGroup2 = new FrontMetricGroup<>(createReporterScopedSettings(), jmMetricGroup.addJob(JobID.generate(), "job_2"));
reporter.notifyOfAddedMetric(metric2, metricName, metricGroup2);
reporter.notifyOfRemovedMetric(metric1, metricName, metricGroup1);
String response = pollMetrics(reporter.getPort()).getBody();
assertThat(response).doesNotContain("job_1");
}
Aggregations