Search in sources :

Example 6 with RemoteDependencyData

use of com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData in project ApplicationInsights-Java by microsoft.

the class KafkaControllerSpansEnabledTest method doMostBasicTest.

@Test
@TargetUri("/sendMessage")
public void doMostBasicTest() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 2);
    Envelope rdEnvelope1 = getRequestEnvelope(rdList, "GET /sendMessage");
    String operationId = rdEnvelope1.getTags().get("ai.operation.id");
    List<Envelope> rddList = mockedIngestion.waitForItemsInOperation("RemoteDependencyData", 3, operationId);
    assertEquals(0, mockedIngestion.getCountForType("EventData"));
    Envelope rdEnvelope2 = getRequestEnvelope(rdList, "mytopic process");
    Envelope rddEnvelope1 = getDependencyEnvelope(rddList, "HelloController.sendMessage");
    Envelope rddEnvelope2 = getDependencyEnvelope(rddList, "mytopic send");
    Envelope rddEnvelope3 = getDependencyEnvelope(rddList, "GET /");
    RequestData rd1 = (RequestData) ((Data<?>) rdEnvelope1.getData()).getBaseData();
    RequestData rd2 = (RequestData) ((Data<?>) rdEnvelope2.getData()).getBaseData();
    RemoteDependencyData rdd1 = (RemoteDependencyData) ((Data<?>) rddEnvelope1.getData()).getBaseData();
    RemoteDependencyData rdd2 = (RemoteDependencyData) ((Data<?>) rddEnvelope2.getData()).getBaseData();
    RemoteDependencyData rdd3 = (RemoteDependencyData) ((Data<?>) rddEnvelope3.getData()).getBaseData();
    assertEquals("GET /sendMessage", rd1.getName());
    assertTrue(rd1.getProperties().isEmpty());
    assertTrue(rd1.getSuccess());
    assertEquals("HelloController.sendMessage", rdd1.getName());
    assertNull(rdd1.getData());
    assertEquals("InProc", rdd1.getType());
    assertNull(rdd1.getTarget());
    assertTrue(rdd1.getProperties().isEmpty());
    assertTrue(rdd1.getSuccess());
    assertEquals("mytopic send", rdd2.getName());
    assertNull(rdd2.getData());
    assertEquals("Queue Message | kafka", rdd2.getType());
    assertEquals("mytopic", rdd2.getTarget());
    assertTrue(rdd2.getProperties().isEmpty());
    assertTrue(rdd2.getSuccess());
    assertEquals("mytopic process", rd2.getName());
    assertEquals("mytopic", rd2.getSource());
    assertTrue(rd2.getProperties().isEmpty());
    assertTrue(rd2.getSuccess());
    assertTrue(rd2.getMeasurements().containsKey("timeSinceEnqueued"));
    assertEquals("GET /", rdd3.getName());
    assertEquals("https://www.bing.com", rdd3.getData());
    assertEquals("Http", rdd3.getType());
    assertEquals("www.bing.com", rdd3.getTarget());
    assertTrue(rdd3.getProperties().isEmpty());
    assertTrue(rdd3.getSuccess());
    assertParentChild(rd1, rdEnvelope1, rddEnvelope1, "GET /sendMessage");
    assertParentChild(rdd1, rddEnvelope1, rddEnvelope2, "GET /sendMessage");
    assertParentChild(rdd2.getId(), rddEnvelope2, rdEnvelope2, "GET /sendMessage", "mytopic process", false);
    assertParentChild(rd2.getId(), rdEnvelope2, rddEnvelope3, "mytopic process", "mytopic process", false);
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Example 7 with RemoteDependencyData

use of com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData in project ApplicationInsights-Java by microsoft.

the class JmsControllerSpansEnabledTest method doMostBasicTest.

@Test
@TargetUri("/sendMessage")
public void doMostBasicTest() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 2);
    Envelope rdEnvelope1 = getRequestEnvelope(rdList, "GET /sendMessage");
    String operationId = rdEnvelope1.getTags().get("ai.operation.id");
    List<Envelope> rddList = mockedIngestion.waitForItemsInOperation("RemoteDependencyData", 3, operationId);
    assertEquals(0, mockedIngestion.getCountForType("EventData"));
    Envelope rdEnvelope2 = getRequestEnvelope(rdList, "message process");
    Envelope rddEnvelope1 = getDependencyEnvelope(rddList, "HelloController.sendMessage");
    Envelope rddEnvelope2 = getDependencyEnvelope(rddList, "message send");
    Envelope rddEnvelope3 = getDependencyEnvelope(rddList, "GET /");
    RequestData rd1 = (RequestData) ((Data<?>) rdEnvelope1.getData()).getBaseData();
    RequestData rd2 = (RequestData) ((Data<?>) rdEnvelope2.getData()).getBaseData();
    RemoteDependencyData rdd1 = (RemoteDependencyData) ((Data<?>) rddEnvelope1.getData()).getBaseData();
    RemoteDependencyData rdd2 = (RemoteDependencyData) ((Data<?>) rddEnvelope2.getData()).getBaseData();
    RemoteDependencyData rdd3 = (RemoteDependencyData) ((Data<?>) rddEnvelope3.getData()).getBaseData();
    assertEquals("GET /sendMessage", rd1.getName());
    assertTrue(rd1.getProperties().isEmpty());
    assertTrue(rd1.getSuccess());
    assertEquals("HelloController.sendMessage", rdd1.getName());
    assertNull(rdd1.getData());
    assertEquals("InProc", rdd1.getType());
    assertNull(rdd1.getTarget());
    assertTrue(rdd1.getProperties().isEmpty());
    assertTrue(rdd1.getSuccess());
    assertEquals("message send", rdd2.getName());
    assertNull(rdd2.getData());
    assertEquals("Queue Message | jms", rdd2.getType());
    assertEquals("message", rdd2.getTarget());
    assertTrue(rdd2.getProperties().isEmpty());
    assertTrue(rdd2.getSuccess());
    assertEquals("message process", rd2.getName());
    assertEquals("message", rd2.getSource());
    assertTrue(rd2.getProperties().isEmpty());
    assertTrue(rd2.getSuccess());
    assertEquals("GET /", rdd3.getName());
    assertEquals("https://www.bing.com", rdd3.getData());
    assertEquals("Http", rdd3.getType());
    assertEquals("www.bing.com", rdd3.getTarget());
    assertTrue(rdd3.getProperties().isEmpty());
    assertTrue(rdd3.getSuccess());
    assertParentChild(rd1, rdEnvelope1, rddEnvelope1, "GET /sendMessage");
    assertParentChild(rdd1, rddEnvelope1, rddEnvelope2, "GET /sendMessage");
    assertParentChild(rdd2.getId(), rddEnvelope2, rdEnvelope2, "GET /sendMessage", "message process", false);
    assertParentChild(rd2.getId(), rdEnvelope2, rddEnvelope3, "message process", "message process", false);
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Example 8 with RemoteDependencyData

use of com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData in project ApplicationInsights-Java by microsoft.

the class JmsTest method doMostBasicTest.

@Test
@TargetUri("/sendMessage")
public void doMostBasicTest() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 2);
    Envelope rdEnvelope1 = getRequestEnvelope(rdList, "GET /sendMessage");
    String operationId = rdEnvelope1.getTags().get("ai.operation.id");
    List<Envelope> rddList = mockedIngestion.waitForItemsInOperation("RemoteDependencyData", 2, operationId);
    assertEquals(0, mockedIngestion.getCountForType("EventData"));
    Envelope rdEnvelope2 = getRequestEnvelope(rdList, "message process");
    Envelope rddEnvelope1 = getDependencyEnvelope(rddList, "message send");
    Envelope rddEnvelope2 = getDependencyEnvelope(rddList, "GET /");
    RequestData rd1 = (RequestData) ((Data<?>) rdEnvelope1.getData()).getBaseData();
    RequestData rd2 = (RequestData) ((Data<?>) rdEnvelope2.getData()).getBaseData();
    RemoteDependencyData rdd1 = (RemoteDependencyData) ((Data<?>) rddEnvelope1.getData()).getBaseData();
    RemoteDependencyData rdd2 = (RemoteDependencyData) ((Data<?>) rddEnvelope2.getData()).getBaseData();
    assertEquals("GET /sendMessage", rd1.getName());
    assertTrue(rd1.getProperties().isEmpty());
    assertTrue(rd1.getSuccess());
    assertEquals("message send", rdd1.getName());
    assertNull(rdd1.getData());
    assertEquals("Queue Message | jms", rdd1.getType());
    assertEquals("message", rdd1.getTarget());
    assertTrue(rdd1.getProperties().isEmpty());
    assertTrue(rdd1.getSuccess());
    assertEquals("message process", rd2.getName());
    assertEquals("message", rd2.getSource());
    assertTrue(rd2.getProperties().isEmpty());
    assertTrue(rd2.getSuccess());
    assertEquals("GET /", rdd2.getName());
    assertEquals("https://www.bing.com", rdd2.getData());
    assertEquals("Http", rdd2.getType());
    assertEquals("www.bing.com", rdd2.getTarget());
    assertTrue(rdd2.getProperties().isEmpty());
    assertTrue(rdd2.getSuccess());
    assertParentChild(rd1, rdEnvelope1, rddEnvelope1, "GET /sendMessage");
    assertParentChild(rdd1.getId(), rddEnvelope1, rdEnvelope2, "GET /sendMessage", "message process", false);
    assertParentChild(rd2.getId(), rdEnvelope2, rddEnvelope2, "message process", "message process", false);
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Example 9 with RemoteDependencyData

use of com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData in project ApplicationInsights-Java by microsoft.

the class SpringCloudStreamControllerSpansEnabledTest method doMostBasicTest.

@Test
@TargetUri("/sendMessage")
public void doMostBasicTest() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 2);
    Envelope rdEnvelope1 = rdList.get(0);
    String operationId = rdEnvelope1.getTags().get("ai.operation.id");
    List<Envelope> rddList = mockedIngestion.waitForItemsInOperation("RemoteDependencyData", 2, operationId);
    assertEquals(0, mockedIngestion.getCountForType("EventData"));
    Envelope rdEnvelope2 = rdList.get(1);
    Envelope rddEnvelope1 = rddList.get(0);
    Envelope rddEnvelope2 = rddList.get(1);
    RequestData rd1 = (RequestData) ((Data<?>) rdEnvelope1.getData()).getBaseData();
    RequestData rd2 = (RequestData) ((Data<?>) rdEnvelope2.getData()).getBaseData();
    RemoteDependencyData rdd1 = (RemoteDependencyData) ((Data<?>) rddEnvelope1.getData()).getBaseData();
    RemoteDependencyData rdd2 = (RemoteDependencyData) ((Data<?>) rddEnvelope2.getData()).getBaseData();
    if (!rdd1.getName().equals("GreetingsController.sendMessage")) {
        RemoteDependencyData rddTemp = rdd1;
        rdd1 = rdd2;
        rdd2 = rddTemp;
        Envelope rddEnvelopeTemp = rddEnvelope1;
        rddEnvelope1 = rddEnvelope2;
        rddEnvelope2 = rddEnvelopeTemp;
    }
    assertEquals("GET /sendMessage", rd1.getName());
    assertTrue(rd1.getProperties().isEmpty());
    assertTrue(rd1.getSuccess());
    assertEquals("GreetingsController.sendMessage", rdd1.getName());
    assertNull(rdd1.getData());
    assertEquals("InProc", rdd1.getType());
    assertNull(rdd1.getTarget());
    assertTrue(rdd1.getProperties().isEmpty());
    assertTrue(rdd1.getSuccess());
    assertEquals("greetings send", rdd2.getName());
    assertNull(rdd2.getData());
    assertEquals("Queue Message | kafka", rdd2.getType());
    assertEquals("greetings", rdd2.getTarget());
    assertTrue(rdd2.getProperties().isEmpty());
    assertTrue(rdd2.getSuccess());
    assertEquals("greetings process", rd2.getName());
    assertEquals("greetings", rd2.getSource());
    assertTrue(rd2.getProperties().isEmpty());
    assertTrue(rd2.getSuccess());
    assertTrue(rd2.getMeasurements().containsKey("timeSinceEnqueued"));
    assertParentChild(rd1, rdEnvelope1, rddEnvelope1, "GET /sendMessage");
    assertParentChild(rdd1, rddEnvelope1, rddEnvelope2, "GET /sendMessage");
    assertParentChild(rdd2.getId(), rddEnvelope2, rdEnvelope2, "GET /sendMessage", "greetings process", false);
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Example 10 with RemoteDependencyData

use of com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData in project ApplicationInsights-Java by microsoft.

the class GrpcTest method doSimpleTest.

@Test
@TargetUri("/simple")
public void doSimpleTest() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 2);
    Envelope rdEnvelope1 = getRequestEnvelope(rdList, "GET /simple");
    Envelope rdEnvelope2 = getRequestEnvelope(rdList, "example.Greeter/SayHello");
    String operationId = rdEnvelope1.getTags().get("ai.operation.id");
    List<Envelope> rddList = mockedIngestion.waitForItemsInOperation("RemoteDependencyData", 1, operationId);
    // auto-collected grpc events are suppressed by exporter because they are noisy
    assertEquals(0, mockedIngestion.getCountForType("MessageData", operationId));
    Envelope rddEnvelope = getDependencyEnvelope(rddList, "example.Greeter/SayHello");
    RequestData rd1 = (RequestData) ((Data<?>) rdEnvelope1.getData()).getBaseData();
    RemoteDependencyData rdd = (RemoteDependencyData) ((Data<?>) rddEnvelope.getData()).getBaseData();
    // TODO this is not correct (or at least not ideal)
    // see https://msazure.visualstudio.com/One/_workitems/edit/8687985
    assertEquals("grpc", rdd.getTarget());
    assertTrue(rd1.getProperties().isEmpty());
    assertTrue(rd1.getSuccess());
    assertTrue(rdd.getProperties().isEmpty());
    assertTrue(rdd.getSuccess());
    // TODO (trask): verify rd2
    assertParentChild(rd1, rdEnvelope1, rddEnvelope, "GET /simple");
    assertParentChild(rdd.getId(), rddEnvelope, rdEnvelope2, "GET /simple", "example.Greeter/SayHello", false);
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Aggregations

Envelope (com.microsoft.applicationinsights.smoketest.schemav2.Envelope)27 RemoteDependencyData (com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData)26 Test (org.junit.Test)26 RequestData (com.microsoft.applicationinsights.smoketest.schemav2.RequestData)25 AiSmokeTest (com.microsoft.applicationinsights.smoketest.AiSmokeTest)10 TargetUri (com.microsoft.applicationinsights.smoketest.TargetUri)10 Data (com.microsoft.applicationinsights.smoketest.schemav2.Data)2 ExceptionData (com.microsoft.applicationinsights.smoketest.schemav2.ExceptionData)2 EventData (com.microsoft.applicationinsights.smoketest.schemav2.EventData)1 ExceptionDetails (com.microsoft.applicationinsights.smoketest.schemav2.ExceptionDetails)1