Search in sources :

Example 6 with ErrorEvent

use of com.newrelic.agent.introspec.ErrorEvent in project newrelic-java-agent by newrelic.

the class GrpcErrorsTest method testUncaughtException.

@Test
public void testUncaughtException() {
    try {
        client.throwException("Blocking");
    } catch (Exception e) {
    }
    String fullMethod = "helloworld.Greeter/ThrowException";
    String clientTxName = "OtherTransaction/Custom/app.TestClient/throwException";
    String serverTxName = "WebTransaction/gRPC/helloworld.Greeter/ThrowException";
    ValidationHelper.validateExceptionGrpcInteraction(server, clientTxName, serverTxName, fullMethod, "UNARY", "Blocking", 2);
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Collection<ErrorEvent> errorEvents = introspector.getErrorEvents();
    CatHelper.verifyOneSuccessfulCat(introspector, clientTxName, serverTxName);
    // Even though gRPC errors are disabled this will still generate an error event
    // because the uncaught exception triggers the agent's built-in error capture
    assertEquals(1, errorEvents.size());
}
Also used : ErrorEvent(com.newrelic.agent.introspec.ErrorEvent) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Aggregations

ErrorEvent (com.newrelic.agent.introspec.ErrorEvent)6 Test (org.junit.Test)6 Introspector (com.newrelic.agent.introspec.Introspector)4 Error (com.newrelic.agent.introspec.Error)2 Event (com.newrelic.agent.introspec.Event)1 DefaultTracer (com.newrelic.agent.tracers.DefaultTracer)1 OtherRootTracer (com.newrelic.agent.tracers.OtherRootTracer)1 Tracer (com.newrelic.agent.tracers.Tracer)1