use of com.navercorp.pinpoint.plugin.mongo.NormalizedBson in project pinpoint by naver.
the class MongoDBITBase method filterData2.
public void filterData2(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl) {
Method find = getMethod(mongoDatabaseImpl, "find", Bson.class);
Bson bson = and(exists("name"), nin("name", 5, 15));
NormalizedBson parsedBson = parseBson(bson);
MongoCursor<Document> cursor = collection.find(bson).iterator();
verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, find, null, MongoDBITConstants.MONGODB_ADDRESS, null, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), "customers"), new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), "secondaryPreferred"), new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), new StringStringValue(parsedBson.getNormalizedBson(), parsedBson.getParameter()))));
assertResultSize(1, cursor);
}
use of com.navercorp.pinpoint.plugin.mongo.NormalizedBson in project pinpoint by naver.
the class MongoDBITBase method insertData.
public void insertData(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl, String collectionInfo, String collectionOption) {
// insert Data
Document doc = new Document("name", "Roy").append("company", "Naver");
collection.insertOne(doc);
Method insertOneMethod = getMethod(mongoDatabaseImpl, "insertOne", Object.class);
NormalizedBson parsedBson = parseBson(doc);
verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, insertOneMethod, null, MongoDBITConstants.MONGODB_ADDRESS, null, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), collectionInfo), new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), collectionOption), new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), new StringStringValue(parsedBson.getNormalizedBson(), parsedBson.getParameter()))));
}
use of com.navercorp.pinpoint.plugin.mongo.NormalizedBson in project pinpoint by naver.
the class MongoDBITBase method insertComlexBsonValueData30.
public void insertComlexBsonValueData30(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl, String collectionInfo, String collectionOption) {
// insert Data
Document document = createComplexDocument();
collection.insertOne(document);
Method insertOneMethod = getMethod(mongoDatabaseImpl, "insertOne", Object.class);
NormalizedBson parsedBson = parseBson(document);
verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, insertOneMethod, null, MongoDBITConstants.MONGODB_ADDRESS, null, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), collectionInfo), new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), collectionOption), new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), new StringStringValue(parsedBson.getNormalizedBson(), parsedBson.getParameter()))));
}
use of com.navercorp.pinpoint.plugin.mongo.NormalizedBson in project pinpoint by naver.
the class MongoRSessionInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
if (collectJson) {
final boolean success = InterceptorUtils.isSuccess(throwable);
if (success) {
if (args != null) {
NormalizedBson parsedBson = MongoUtil.parseBson(args, traceBsonBindValue);
MongoUtil.recordParsedBson(recorder, parsedBson);
}
}
}
recorder.recordException(throwable);
if (isAsynchronousInvocation(target, args, result, throwable)) {
// Trace to Disposable object
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) (result))._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set AsyncContext {}, result={}", asyncContext, result);
}
}
}
Aggregations