use of com.newrelic.agent.stats.Stats in project newrelic-java-agent by newrelic.
the class DistributedTraceCrossAgentTest method assertExpectedMetrics.
private void assertExpectedMetrics(ArrayList metrics, TransactionStats transactionStats) {
Assert.assertNotNull(transactionStats);
for (Object metric : metrics) {
ArrayList expectedStats = (ArrayList) metric;
String expectedMetricName = (String) expectedStats.get(0);
Long expectedMetricCount = (Long) ((JSONArray) metric).get(1);
final String message = String.format("Expected call count %d for: %s", expectedMetricCount, expectedMetricName);
if (expectedMetricName.startsWith("Supportability") || expectedMetricName.startsWith("ErrorsByCaller")) {
Stats actualStat = transactionStats.getUnscopedStats().getStats(expectedMetricName);
Assert.assertEquals(message, expectedMetricCount.intValue(), actualStat.getCallCount());
} else {
ResponseTimeStats actualStat = transactionStats.getUnscopedStats().getOrCreateResponseTimeStats(expectedMetricName);
Assert.assertEquals(message, expectedMetricCount.intValue(), actualStat.getCallCount());
}
}
}
Aggregations