use of com.nr.vertx.test.handlers.ProductHandlers in project newrelic-java-agent by newrelic.
the class HandlerTracingTest method testLambdaNames.
@Test
public void testLambdaNames() {
Vertx vertx = Vertx.vertx();
try {
Router router = Router.router(vertx);
router.route().path("/products").handler(ProductHandlers::getAllProducts);
router.route().path("/product/:pid").handler(ProductHandlers.getProductHandler());
HttpServer server = createServer(vertx, router);
getRequest("/products/", server).then().statusCode(200);
Map<String, TracedMetricData> metrics = getMetrics("OtherTransaction/Vertx/products (GET)");
assertTrue(metrics.containsKey("com.nr.vertx.instrumentation.HandlerTracingTest.lambda()"));
InstrumentationTestRunner.getIntrospector().clear();
getRequest("/product/milk", server).then().statusCode(200);
metrics = getMetrics("OtherTransaction/Vertx/product/:pid (GET)");
assertTrue(metrics.containsKey("com.nr.vertx.test.handlers.ProductHandlers.lambda()"));
InstrumentationTestRunner.getIntrospector().clear();
} finally {
vertx.close();
}
}
use of com.nr.vertx.test.handlers.ProductHandlers in project newrelic-java-agent by newrelic.
the class HandlerTracingTest method testLambdaNamesBlocking.
@Test
public void testLambdaNamesBlocking() {
Vertx vertx = Vertx.vertx();
try {
Router router = Router.router(vertx);
router.route().path("/products").blockingHandler(ProductHandlers::getAllProducts);
router.route().path("/product/:pid").blockingHandler(ProductHandlers.getProductHandler());
HttpServer server = createServer(vertx, router);
getRequest("/products/", server).then().statusCode(200);
Map<String, TracedMetricData> metrics = getMetrics("OtherTransaction/Vertx/products (GET)");
assertTrue(metrics.containsKey("com.nr.vertx.instrumentation.HandlerTracingTest.lambda()"));
InstrumentationTestRunner.getIntrospector().clear();
getRequest("/product/milk", server).then().statusCode(200);
metrics = getMetrics("OtherTransaction/Vertx/product/:pid (GET)");
assertTrue(metrics.containsKey("com.nr.vertx.test.handlers.ProductHandlers.lambda()"));
InstrumentationTestRunner.getIntrospector().clear();
} finally {
vertx.close();
}
}
Aggregations