Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amirhadadi/6e4580c7e91887e53f0993d30e619674 to your computer and use it in GitHub Desktop.
Save amirhadadi/6e4580c7e91887e53f0993d30e619674 to your computer and use it in GitHub Desktop.
Fix SemanticFolsomMetricsTest::testRegisterOutstandingRequestsGauge
@Test
public void testRegisterOutstandingRequestsGauge() {
metrics.registerOutstandingRequestsGauge(new OutstandingRequestsGauge() {
@Override
public int getOutstandingRequests() {
return 6;
}
@Override
public String getHostName() {
return "memcached1";
}
});
metrics.registerOutstandingRequestsGauge(new OutstandingRequestsGauge() {
@Override
public int getOutstandingRequests() {
return 7;
}
@Override
public String getHostName() {
return "memcached2";
}
});
@SuppressWarnings("rawtypes")
final SortedMap<MetricId, Gauge> allHostsGauge =
registry.getGauges(
(name, metric) -> "outstanding-requests".equals(name.getTags().get("what")) && "all".equals(name.getTags().get("host")));
assertEquals(1, allHostsGauge.size());
assertEquals(13L, allHostsGauge.values().iterator().next().getValue());
@SuppressWarnings("rawtypes")
final SortedMap<MetricId, Gauge> hostGauge =
registry.getGauges(
(name, metric) -> "outstanding-requests".equals(name.getTags().get("what")) && "memcached1".equals(name.getTags().get("host")));
assertEquals(1, hostGauge.size());
assertEquals(6L, hostGauge.values().iterator().next().getValue());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment