Search in sources :

Example 1 with ActorB

use of com.nr.instrumentation.akka22.test.actors.broadcasting.ActorB in project newrelic-java-agent by newrelic.

the class AkkaTest method testBroadcast.

@Test
public void testBroadcast() throws InterruptedException {
    ActorSystem system = ActorSystem.create("AkkaTestSystem");
    TestApp.broadcastInTransaction(system);
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    int finishedTransactionCount = introspector.getFinishedTransactionCount(5000);
    assertEquals(1, finishedTransactionCount);
    String transactionName = "OtherTransaction/Akka/Broadcast";
    Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(transactionName);
    assertTrue(metricsForTransaction.containsKey("Akka/receive/" + ActorA.class.getName()));
    assertTrue(metricsForTransaction.containsKey("Akka/receive/" + ActorB.class.getName()));
    assertTrue(metricsForTransaction.containsKey("Akka/receive/" + ActorC.class.getName()));
    Map<String, TracedMetricData> unscopedMetrics = introspector.getUnscopedMetrics();
    assertTrue(unscopedMetrics.containsKey("ActorA"));
    assertTrue(unscopedMetrics.containsKey("ActorB"));
    assertTrue(unscopedMetrics.containsKey("ActorC"));
}
Also used : ActorSystem(akka.actor.ActorSystem) TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) ActorA(com.nr.instrumentation.akka22.test.actors.broadcasting.ActorA) Introspector(com.newrelic.agent.introspec.Introspector) ActorB(com.nr.instrumentation.akka22.test.actors.broadcasting.ActorB) ActorC(com.nr.instrumentation.akka22.test.actors.broadcasting.ActorC) Test(org.junit.Test)

Example 2 with ActorB

use of com.nr.instrumentation.akka22.test.actors.broadcasting.ActorB in project newrelic-java-agent by newrelic.

the class TestApp method broadcastInTransaction.

@Trace(dispatcher = true)
public static void broadcastInTransaction(ActorSystem system) throws InterruptedException {
    ActorRef actorA = system.actorOf(Props.create(ActorA.class));
    ActorRef actorB = system.actorOf(Props.create(ActorB.class));
    ActorRef actorC = system.actorOf(Props.create(ActorC.class));
    // Let system initialize
    Thread.sleep(1000);
    system.actorSelection("/user/*").tell("message", null);
    // Let all actors process messages
    Thread.sleep(2000);
}
Also used : ActorRef(akka.actor.ActorRef) ActorA(com.nr.instrumentation.akka22.test.actors.broadcasting.ActorA) ActorB(com.nr.instrumentation.akka22.test.actors.broadcasting.ActorB) ActorC(com.nr.instrumentation.akka22.test.actors.broadcasting.ActorC) Trace(com.newrelic.api.agent.Trace)

Aggregations

ActorA (com.nr.instrumentation.akka22.test.actors.broadcasting.ActorA)2 ActorB (com.nr.instrumentation.akka22.test.actors.broadcasting.ActorB)2 ActorC (com.nr.instrumentation.akka22.test.actors.broadcasting.ActorC)2 ActorRef (akka.actor.ActorRef)1 ActorSystem (akka.actor.ActorSystem)1 Introspector (com.newrelic.agent.introspec.Introspector)1 TracedMetricData (com.newrelic.agent.introspec.TracedMetricData)1 Trace (com.newrelic.api.agent.Trace)1 Test (org.junit.Test)1