use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class IntrospectorStatsService method convertToTracedMetric.
private Map<String, TracedMetricData> convertToTracedMetric(SimpleStatsEngine currentEngine) {
Map<String, TracedMetricData> output = Maps.newHashMapWithExpectedSize(currentEngine.getSize());
for (Entry<String, StatsBase> current : currentEngine.getStatsMap().entrySet()) {
if (current.getValue() instanceof CountStats) {
TracedMetricData data = TracedMetricImpl.getTracedMetricFromStatsBase(current.getKey(), (CountStats) current.getValue());
output.put(current.getKey(), data);
}
}
return output;
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class IntrospectorStatsService method getUnscopedMetrics.
public Map<String, TracedMetricData> getUnscopedMetrics() {
SimpleStatsEngine unscoped = engine.getUnscopedStatsForTesting();
Map<String, TracedMetricData> unscopedMetricMap = convertToTracedMetric(unscoped);
// copies of scoped metrics -> unscoped
List<MetricData> allScopedMetricData = new ArrayList<>();
for (Entry<String, SimpleStatsEngine> entry : engine.getScopedStatsForTesting().entrySet()) {
allScopedMetricData.addAll(entry.getValue().getMetricData(metricNormalizer, entry.getKey()));
}
List<MetricData> unscopedCopies = StatsEngineImpl.createUnscopedCopies(metricNormalizer, allScopedMetricData);
for (MetricData unscopedCopy : unscopedCopies) {
if (unscopedCopy.getStats() instanceof CountStats) {
String metricName = unscopedCopy.getMetricName().getName();
TracedMetricData data = TracedMetricImpl.getTracedMetricFromStatsBase(metricName, (CountStats) unscopedCopy.getStats());
unscopedMetricMap.put(metricName, data);
}
}
return unscopedMetricMap;
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class JaxRsTests method testUserService.
@Test
public void testUserService() {
assertEquals("User Features!", App.callUserServiceImpl());
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = "OtherTransaction/RestWebService/v1/user/{id}/features (GET)";
Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
assertEquals(1, metricsForTransaction.get("Java/com.nr.instrumentation.javax.ws.rs.api.UserServiceImpl/getUserFeatures").getCallCount());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class JaxRsTests method testTransactionNameInterfaceException.
@Test
public void testTransactionNameInterfaceException() {
assertEquals("Got it from the interface!", App.callExceptionInterfaceResourceInTransaction());
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = "OtherTransaction/RestWebService/interface (GET)";
Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
assertEquals(1, metricsForTransaction.get("Java/com.nr.instrumentation.javax.ws.rs.api.InterfaceResourceImpl/exceptionTest").getCallCount());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class JaxRsTests method testTransactionNameClassLargeParameters.
@Test
public void testTransactionNameClassLargeParameters() {
assertEquals("Got it!", App.callLargeParametersClassResourceInTransaction());
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = "OtherTransaction/RestWebService/class (GET)";
Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
assertEquals(1, metricsForTransaction.get("Java/com.nr.instrumentation.javax.ws.rs.api.ClassResource/largeNumberOfParametersTest").getCallCount());
}
Aggregations