use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class DynamoApiTest method testPutAndGetItem.
@Test
public void testPutAndGetItem() {
putAndGetTxn();
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(10000));
String txName = introspector.getTransactionNames().iterator().next();
DatastoreHelper helper = new DatastoreHelper(DYNAMODB_PRODUCT);
helper.assertScopedStatementMetricCount(txName, "putItem", TABLE_NAME, 1);
helper.assertScopedStatementMetricCount(txName, "getItem", TABLE_NAME, 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 DynamoApiTest method testUpdateItem.
@Test
public void testUpdateItem() {
putItem();
UpdateItemResult result = updateItemTxn();
assertNotNull(result);
Map<String, AttributeValue> item = getItem().getItem();
AttributeValue attr = item.get("rating");
assertNotNull(attr);
assertEquals("{S: 5 stars,}", attr.toString());
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(10000));
String txName = introspector.getTransactionNames().iterator().next();
DatastoreHelper helper = new DatastoreHelper(DYNAMODB_PRODUCT);
helper.assertScopedStatementMetricCount(txName, "updateItem", "test", 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 DynamoApiTest method testBadGetAsync.
@Test
public void testBadGetAsync() {
getOrCreateTable(TABLE_NAME);
getWrongItemAsyncTxn();
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(10000));
String txName = introspector.getTransactionNames().iterator().next();
Collection<TransactionEvent> transactionEvents = introspector.getTransactionEvents(txName);
TransactionEvent event = transactionEvents.iterator().next();
Map<String, Object> attributes = event.getAttributes();
assertEquals(5, attributes.get("Miley Cyrus is not jazz"));
assertEquals(100, attributes.get("Mingus is totally jazz"));
DatastoreHelper helper = new DatastoreHelper(DYNAMODB_PRODUCT);
helper.assertScopedStatementMetricCount(txName, "getItem", "test", 2);
helper.assertAggregateMetrics();
helper.assertInstanceLevelMetric(DYNAMODB_PRODUCT, hostName, port);
}
use of com.newrelic.agent.introspec.DatastoreHelper in project newrelic-java-agent by newrelic.
the class DynamoApiTest method testBatchWrite.
@Test
public void testBatchWrite() {
getOrCreateTable(TABLE_NAME);
getOrCreateTable(SECOND_TABLE_NAME);
batchWriteTxn();
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 DynamoApiTest method testBatchGetAsync.
@Test
public void testBatchGetAsync() throws ExecutionException, InterruptedException {
getOrCreateTable(TABLE_NAME);
batchGetAsyncTxn();
Introspector introspector = InstrumentationTestRunner.getIntrospector();
assertEquals(1, introspector.getFinishedTransactionCount(10000));
String txName = introspector.getTransactionNames().iterator().next();
DatastoreHelper helper = new DatastoreHelper(DYNAMODB_PRODUCT);
helper.assertScopedStatementMetricCount(txName, "batchGetItem", "batch", 1);
helper.assertAggregateMetrics();
helper.assertInstanceLevelMetric(DYNAMODB_PRODUCT, hostName, port);
}
Aggregations