use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class DynamoApiTest method testBatchPutAsync.
@Test
public void testBatchPutAsync() {
getOrCreateTable(TABLE_NAME);
batchPutTxnAsync();
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(10000));
String txName = introspector.getTransactionNames().iterator().next();
DatastoreHelper helper = new DatastoreHelper(DYNAMODB_PRODUCT);
helper.assertScopedStatementMetricCount(txName, "batchWriteItem", "batch", 1);
helper.assertAggregateMetrics();
helper.assertInstanceLevelMetric(DYNAMODB_PRODUCT, hostName, port);
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class CassandraTest method testBasic.
@Test
public void testBasic() {
demoBasic();
assertEquals(1, InstrumentationTestRunner.getIntrospector().getFinishedTransactionCount(1000));
Collection<String> transactionNames = InstrumentationTestRunner.getIntrospector().getTransactionNames();
assertEquals(1, transactionNames.size());
String txName = transactionNames.iterator().next();
DatastoreHelper helper = new DatastoreHelper(CASSANDRA_PRODUCT);
helper.assertScopedStatementMetricCount(txName, "INSERT", "users", 1);
helper.assertScopedStatementMetricCount(txName, "SELECT", "users", 3);
helper.assertScopedStatementMetricCount(txName, "UPDATE", "users", 1);
helper.assertScopedStatementMetricCount(txName, "DELETE", "users", 1);
helper.assertAggregateMetrics();
helper.assertUnscopedOperationMetricCount("INSERT", 1);
helper.assertUnscopedOperationMetricCount("SELECT", 3);
helper.assertUnscopedOperationMetricCount("UPDATE", 1);
helper.assertUnscopedOperationMetricCount("DELETE", 1);
helper.assertUnscopedStatementMetricCount("INSERT", "users", 1);
helper.assertUnscopedStatementMetricCount("SELECT", "users", 3);
helper.assertUnscopedStatementMetricCount("UPDATE", "users", 1);
helper.assertUnscopedStatementMetricCount("DELETE", "users", 1);
Collection<TransactionTrace> traces = InstrumentationTestRunner.getIntrospector().getTransactionTracesForTransaction(txName);
assertEquals(1, traces.size());
TransactionTrace trace = Iterables.getFirst(traces, null);
assertNotNull(trace);
assertBasicTraceSegmentAttributes(trace);
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class CassandraInstrumented method testSyncBasicRequests.
@Test
public void testSyncBasicRequests() {
// Given
Introspector introspector = InstrumentationTestRunner.getIntrospector();
DatastoreHelper helper = new DatastoreHelper(DatastoreVendor.Cassandra.toString());
// When
CassandraTestUtils.syncBasicRequests(cassandra.session);
// Then
assertEquals(1, introspector.getFinishedTransactionCount(1000));
assertEquals(1, introspector.getTransactionNames().size());
String transactionName = introspector.getTransactionNames().stream().findFirst().orElse("");
helper.assertScopedStatementMetricCount(transactionName, "INSERT", "users", 1);
helper.assertScopedStatementMetricCount(transactionName, "SELECT", "users", 3);
helper.assertScopedStatementMetricCount(transactionName, "UPDATE", "users", 1);
helper.assertScopedStatementMetricCount(transactionName, "DELETE", "users", 1);
helper.assertAggregateMetrics();
helper.assertUnscopedOperationMetricCount("INSERT", 1);
helper.assertUnscopedOperationMetricCount("SELECT", 3);
helper.assertUnscopedOperationMetricCount("UPDATE", 1);
helper.assertUnscopedOperationMetricCount("DELETE", 1);
helper.assertUnscopedStatementMetricCount("INSERT", "users", 1);
helper.assertUnscopedStatementMetricCount("SELECT", "users", 3);
helper.assertUnscopedStatementMetricCount("UPDATE", "users", 1);
helper.assertUnscopedStatementMetricCount("DELETE", "users", 1);
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class CassandraNoInstrumentation method testSyncBasicRequests.
@Test
public void testSyncBasicRequests() {
// Given
Introspector introspector = InstrumentationTestRunner.getIntrospector();
DatastoreHelper helper = new DatastoreHelper(DatastoreVendor.Cassandra.toString());
// When
CassandraTestUtils.syncBasicRequests(cassandra.session);
// Then
assertEquals(1, introspector.getFinishedTransactionCount(1000));
assertEquals(1, introspector.getTransactionNames().size());
String transactionName = introspector.getTransactionNames().stream().findFirst().orElse("");
helper.assertScopedStatementMetricCount(transactionName, "INSERT", "users", 0);
helper.assertScopedStatementMetricCount(transactionName, "SELECT", "users", 0);
helper.assertScopedStatementMetricCount(transactionName, "UPDATE", "users", 0);
helper.assertScopedStatementMetricCount(transactionName, "DELETE", "users", 0);
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class MariaDbTest method testCrud.
@Test
@Ignore
public void testCrud() throws Exception {
mariaDbInsert();
mariaDbReadInsert();
mariaDbUpdate();
mariaDbReadUpdate();
mariaDbDelete();
mariaDbReadDelete();
Introspector introspector = InstrumentationTestRunner.getIntrospector();
Assert.assertEquals(6, introspector.getFinishedTransactionCount());
DatastoreHelper helper = new DatastoreHelper("MySQL");
helper.assertAggregateMetrics();
// C
helper.assertUnscopedOperationMetricCount("insert", 1);
// R (once per step)
helper.assertUnscopedOperationMetricCount("select", 3);
// U
helper.assertUnscopedOperationMetricCount("update", 1);
// D
helper.assertUnscopedOperationMetricCount("delete", 1);
}
Aggregations