use of com.nr.agent.mongo.NRCallbackWrapper in project newrelic-java-agent by newrelic.
the class MongoIterableImpl_Instrumentation method first.
@Trace
public void first(SingleResultCallback<TResult> callback) {
if (!(callback instanceof NRCallbackWrapper)) {
NRCallbackWrapper<TResult> wrapper = new NRCallbackWrapper<TResult>(callback);
wrapper.token = NewRelic.getAgent().getTransaction().getToken();
DatastoreParameters datastoreParameters;
if (databaseName != null) {
datastoreParameters = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(collectionName).operation(operationName).noInstance().databaseName(databaseName).build();
} else {
datastoreParameters = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(collectionName).operation(operationName).build();
}
wrapper.params = datastoreParameters;
wrapper.segment = NewRelic.getAgent().getTransaction().startSegment(operationName);
callback = wrapper;
}
Weaver.callOriginal();
}
use of com.nr.agent.mongo.NRCallbackWrapper in project newrelic-java-agent by newrelic.
the class AsyncMongoIterableImpl_Instrumentation method first.
@Trace
public void first(SingleResultCallback<TResult> callback) {
if (!(callback instanceof NRCallbackWrapper)) {
NRCallbackWrapper<TResult> wrapper = new NRCallbackWrapper<>(callback);
wrapper.token = NewRelic.getAgent().getTransaction().getToken();
DatastoreParameters datastoreParameters;
if (databaseName != null) {
datastoreParameters = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(collectionName).operation(operationName).noInstance().databaseName(databaseName).build();
} else {
datastoreParameters = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(collectionName).operation(operationName).build();
}
wrapper.params = datastoreParameters;
wrapper.segment = NewRelic.getAgent().getTransaction().startSegment(operationName);
callback = wrapper;
}
Weaver.callOriginal();
}
use of com.nr.agent.mongo.NRCallbackWrapper in project newrelic-java-agent by newrelic.
the class MongoCollectionImpl_Instrumentation method instrument.
private <T> SingleResultCallback<T> instrument(SingleResultCallback<T> callback, String operationName) {
if (callback instanceof NRCallbackWrapper) {
return callback;
}
NRCallbackWrapper<T> wrapper = new NRCallbackWrapper<T>(callback);
DatastoreParameters params = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(getNamespace().getCollectionName()).operation(operationName).instance(address.getHost(), address.getPort()).databaseName(getNamespace().getDatabaseName()).build();
wrapper.params = params;
wrapper.token = NewRelic.getAgent().getTransaction().getToken();
wrapper.segment = NewRelic.getAgent().getTransaction().startSegment(operationName);
return wrapper;
}
Aggregations