use of com.newrelic.api.agent.DatastoreParameters in project newrelic-java-agent by newrelic.
the class DB_Weave method instrument.
private void instrument(TracedMethod method, String operation, String collection, String serverUsed, int serverPortUsed) {
DatastoreParameters params = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(collection).operation(operation).instance(serverUsed, serverPortUsed).databaseName(getName()).build();
method.reportAsExternal(params);
}
use of com.newrelic.api.agent.DatastoreParameters in project newrelic-java-agent by newrelic.
the class DBCollection_Weave method instrument.
private void instrument(TracedMethod method, String operationName) {
ServerAddress serverAddress = getDB().getMongo().getAddress();
DatastoreParameters params = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(getNamespace().getCollectionName()).operation(operationName).instance(serverAddress.getHost(), serverAddress.getPort()).databaseName(getDB().getName()).build();
NewRelic.getAgent().getTracedMethod().reportAsExternal(params);
}
use of com.newrelic.api.agent.DatastoreParameters 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.newrelic.api.agent.DatastoreParameters in project newrelic-java-agent by newrelic.
the class Connection_Instrumentation method getMore.
@Trace(leaf = true)
public <T> QueryResult<T> getMore(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder) {
DatastoreParameters params = DatastoreParameters.product(DatastoreVendor.MongoDB.name()).collection(namespace.getCollectionName()).operation(MongoUtil.OP_GET_MORE).instance(getDescription().getServerAddress().getHost(), getDescription().getServerAddress().getPort()).databaseName(namespace.getDatabaseName()).build();
NewRelic.getAgent().getTracedMethod().reportAsExternal(params);
return Weaver.callOriginal();
}
use of com.newrelic.api.agent.DatastoreParameters 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();
}
Aggregations