HADOOP-9946. NumAllSinks metrics shows lower value than NumActiveSinks (#5002)
Reviewed-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
parent
e6edbf1b4b
commit
0a26d84df1
|
@ -280,7 +280,6 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
|
||||||
}
|
}
|
||||||
return sink;
|
return sink;
|
||||||
}
|
}
|
||||||
allSinks.put(name, sink);
|
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
registerSink(name, description, sink);
|
registerSink(name, description, sink);
|
||||||
}
|
}
|
||||||
|
@ -301,6 +300,7 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
|
||||||
? newSink(name, desc, sink, conf)
|
? newSink(name, desc, sink, conf)
|
||||||
: newSink(name, desc, sink, config.subset(SINK_KEY));
|
: newSink(name, desc, sink, config.subset(SINK_KEY));
|
||||||
sinks.put(name, sa);
|
sinks.put(name, sa);
|
||||||
|
allSinks.put(name, sink);
|
||||||
sa.start();
|
sa.start();
|
||||||
LOG.info("Registered sink "+ name);
|
LOG.info("Registered sink "+ name);
|
||||||
}
|
}
|
||||||
|
@ -508,6 +508,7 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
|
||||||
conf.getString(DESC_KEY, sinkName), conf);
|
conf.getString(DESC_KEY, sinkName), conf);
|
||||||
sa.start();
|
sa.start();
|
||||||
sinks.put(sinkName, sa);
|
sinks.put(sinkName, sa);
|
||||||
|
allSinks.put(sinkName, sa.sink());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Error creating sink '"+ sinkName +"'", e);
|
LOG.warn("Error creating sink '"+ sinkName +"'", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,6 +438,8 @@ public class TestMetricsSystemImpl {
|
||||||
r = recs.get(1);
|
r = recs.get(1);
|
||||||
assertTrue("NumActiveSinks should be 3", Iterables.contains(r.metrics(),
|
assertTrue("NumActiveSinks should be 3", Iterables.contains(r.metrics(),
|
||||||
new MetricGaugeInt(MsInfo.NumActiveSinks, 3)));
|
new MetricGaugeInt(MsInfo.NumActiveSinks, 3)));
|
||||||
|
assertTrue("NumAllSinks should be 3",
|
||||||
|
Iterables.contains(r.metrics(), new MetricGaugeInt(MsInfo.NumAllSinks, 3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue