use of com.newrelic.agent.metric.MetricName in project newrelic-java-agent by newrelic.
the class ApiTest method testNoExceptionRecordMetricNoTransaction.
@Test
public void testNoExceptionRecordMetricNoTransaction() throws Exception {
final MetricName name = MetricName.create("roger");
StatsWork statsWork = new StatsWork() {
@Override
public void doWork(StatsEngine statsEngine) {
statsEngine.getApdexStats(name);
try {
statsEngine.getStats(name);
Assert.fail("expected java.lang.RuntimeException");
} catch (RuntimeException e) {
// expected
}
}
@Override
public String getAppName() {
return null;
}
};
ServiceFactory.getStatsService().doStatsWork(statsWork, "statsWorkName");
NewRelic.recordMetric(name.getName(), 1.0f);
}
use of com.newrelic.agent.metric.MetricName in project newrelic-java-agent by newrelic.
the class QueueTimeTracker method recordMetrics.
public void recordMetrics(TransactionStats statsEngine) {
if (queueTime > 0L) {
MetricName name = MetricName.QUEUE_TIME;
statsEngine.getUnscopedStats().getOrCreateResponseTimeStats(name.getName()).recordResponseTimeInNanos(queueTime);
}
}
use of com.newrelic.agent.metric.MetricName in project newrelic-java-agent by newrelic.
the class TransactionDataList method getMetricCounts.
public Map<String, Integer> getMetricCounts(Set<MetricName> responseTimeMetricNames) {
Map<String, Integer> metricNameToCounts = new HashMap<>();
synchronized (statsEngine) {
for (MetricName responseTimeMetricName : responseTimeMetricNames) {
ResponseTimeStats responseTimeStats = statsEngine.getResponseTimeStats(responseTimeMetricName);
metricNameToCounts.put(responseTimeMetricName.getName(), responseTimeStats.getCallCount());
}
}
return metricNameToCounts;
}
use of com.newrelic.agent.metric.MetricName in project newrelic-java-agent by newrelic.
the class AgentHelper method getMetricNames.
public static Set<MetricName> getMetricNames(Collection<MetricData> dataList) {
Set<MetricName> metrics = new HashSet<>();
for (MetricData data : dataList) {
MetricName metricName = data.getMetricName();
metrics.add(metricName);
}
return metrics;
}
Aggregations