use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class MongoDb310Test method testCRUD.
@Test
public void testCRUD() throws Exception {
demoCRUD(new PokemonMaster(mongoClient));
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(1000));
DatastoreHelper helper = new DatastoreHelper(MONGODB_PRODUCT);
helper.assertAggregateMetrics();
Collection<String> transactionNames = InstrumentationTestRunner.getIntrospector().getTransactionNames();
assertEquals(1, transactionNames.size());
String txName = transactionNames.iterator().next();
helper.assertUnifiedMetricCounts(txName, "insert", "pokemon", 1);
helper.assertUnifiedMetricCounts(txName, "find", "pokemon", 2);
helper.assertUnifiedMetricCounts(txName, "update", "pokemon", 1);
helper.assertUnifiedMetricCounts(txName, "delete", "pokemon", 1);
assertEquals(5, MetricsHelper.getUnscopedMetricCount("Datastore/all"));
assertEquals(5, (int) introspector.getTransactionEvents(txName).iterator().next().getDatabaseCallCount());
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class MongoDb370Test method testCRUD.
@Test
public void testCRUD() throws Exception {
demoCRUD(new PokemonMaster(mongoClient));
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(1000));
DatastoreHelper helper = new DatastoreHelper(MONGODB_PRODUCT);
helper.assertAggregateMetrics();
Collection<String> transactionNames = InstrumentationTestRunner.getIntrospector().getTransactionNames();
assertEquals(1, transactionNames.size());
String txName = transactionNames.iterator().next();
helper.assertUnifiedMetricCounts(txName, "insert", "pokemon", 1);
helper.assertUnifiedMetricCounts(txName, "find", "pokemon", 2);
helper.assertUnifiedMetricCounts(txName, "update", "pokemon", 1);
helper.assertUnifiedMetricCounts(txName, "delete", "pokemon", 1);
assertEquals(5, MetricsHelper.getUnscopedMetricCount("Datastore/all"));
assertEquals(5, (int) introspector.getTransactionEvents(txName).iterator().next().getDatabaseCallCount());
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class MongoDb370Test method testCollectionApi.
@Test
public void testCollectionApi() throws Exception {
runQuickTour();
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(1000));
DatastoreHelper helper = new DatastoreHelper(MONGODB_PRODUCT);
helper.assertAggregateMetrics();
helper.assertUnscopedOperationMetricCount("dropDatabase", 1);
Collection<String> transactionNames = InstrumentationTestRunner.getIntrospector().getTransactionNames();
assertEquals(1, transactionNames.size());
String txName = transactionNames.iterator().next();
helper.assertUnifiedMetricCounts(txName, "insert", "test", 4);
helper.assertUnifiedMetricCounts(txName, "update", "test", 6);
helper.assertUnifiedMetricCounts(txName, "delete", "test", 4);
helper.assertUnifiedMetricCounts(txName, "find", "test", 13);
helper.assertUnifiedMetricCounts(txName, "drop", "test", 3);
helper.assertUnifiedMetricCounts(txName, "count", "test", 1);
helper.assertUnifiedMetricCounts(txName, "getMore", "test", 12);
assertEquals(44, MetricsHelper.getUnscopedMetricCount("Datastore/all"));
assertEquals(44, (int) introspector.getTransactionEvents(txName).iterator().next().getDatabaseCallCount());
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class MongoDb214Test method testAggregation.
@Test
public void testAggregation() throws Exception {
demoAggregation(new PokemonMaster(mongoClient));
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount());
DatastoreHelper helper = new DatastoreHelper(MONGODB_PRODUCT);
helper.assertAggregateMetrics();
Collection<String> transactionNames = InstrumentationTestRunner.getIntrospector().getTransactionNames();
assertEquals(1, transactionNames.size());
String txName = transactionNames.iterator().next();
helper.assertUnifiedMetricCounts(txName, "aggregate", "pokemon", 2);
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class MongoDb214Test method testFindAndModify.
@Test
public void testFindAndModify() throws Exception {
demoFindAndModify(new PokemonMaster(mongoClient));
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount());
DatastoreHelper helper = new DatastoreHelper(MONGODB_PRODUCT);
helper.assertAggregateMetrics();
Collection<String> transactionNames = InstrumentationTestRunner.getIntrospector().getTransactionNames();
assertEquals(1, transactionNames.size());
String txName = transactionNames.iterator().next();
helper.assertUnifiedMetricCounts(txName, "findandmodify", "pokemon", 1);
}
Aggregations