use of com.newrelic.agent.threads.BasicThreadInfo in project newrelic-java-agent by newrelic.
the class ProfileTest method testTopDownTree.
@Test
public void testTopDownTree() {
IProfile profile = treeTestProfile();
String normalizedThreadName = threadNameNormalizer.getNormalizedThreadName(new BasicThreadInfo(getMockedThreadInfo(0)));
verifyTree(profile.getProfileTree(normalizedThreadName), new HashMap<String, Integer>() {
private static final long serialVersionUID = 1L;
{
put("a", 4);
}
});
}
use of com.newrelic.agent.threads.BasicThreadInfo in project newrelic-java-agent by newrelic.
the class TransactionProfileSessionImpl method noticeTracerStart.
@Override
public void noticeTracerStart(int signatureId, int tracerFlags, Tracer tracer) {
if (!threadService.isCurrentThreadAnAgentThread()) {
if (tracer == null) {
discoveryProfile.noticeStartTracer(signatureId);
Thread currentThread = Thread.currentThread();
profile.addStackTrace(new BasicThreadInfo(currentThread), currentThread.getStackTrace(), true, ThreadType.BasicThreadType.OTHER);
} else if (tracer.isLeaf() || tracer instanceof IgnoreChildSocketCalls) {
if (stackTraceLimits.get(tracer.getMetricName()).getAndIncrement() < STACK_CAPTURE_LIMIT_PER_METRIC_PER_PERIOD) {
tracer.setAgentAttribute(DefaultTracer.BACKTRACE_PARAMETER_NAME, Thread.currentThread().getStackTrace());
}
}
}
}
use of com.newrelic.agent.threads.BasicThreadInfo in project newrelic-java-agent by newrelic.
the class Profile method getAgentThreadNames.
private Collection<Object> getAgentThreadNames() {
Set<Long> agentThreadIds = ServiceFactory.getThreadService().getAgentThreadIds();
Set<Object> names = new HashSet<>();
for (long id : agentThreadIds) {
ThreadInfo threadInfo = threadMXBean.getThreadInfo(id, 0);
names.add(stringMap.addString(threadNameNormalizer.getNormalizedThreadName(new BasicThreadInfo(threadInfo))));
}
return new ArrayList<>(names);
}
Aggregations