Created
July 29, 2020 22:30
-
-
Save amirhadadi/6e4580c7e91887e53f0993d30e619674 to your computer and use it in GitHub Desktop.
Fix SemanticFolsomMetricsTest::testRegisterOutstandingRequestsGauge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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