This commit is contained in:
lytscu 2017-11-16 20:38:30 +08:00
parent 1182e8a9bf
commit 726d1d6b0c
3 changed files with 24 additions and 13 deletions

View File

@ -37,8 +37,7 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptR
import org.skywalking.apm.network.trace.component.ComponentsDefine;
/**
* {@link MongoDBCollectionMethodInterceptor} intercept method of {@link com.mongodb.DBCollection#find()}
* or{@link com.mongodb.DBCollectionImpl#insert}.... record the mongoDB host, operation name ...
* {@link MongoDBCollectionMethodInterceptor} intercept {@link com.mongodb.DBCollectionImpl}{@link com.mongodb.DBCollection}class
*/
public class MongoDBCollectionMethodInterceptor implements InstanceMethodsAroundInterceptor, InstanceConstructorInterceptor {

View File

@ -31,9 +31,16 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link MongoDBCollectionImplInstrumentation} presents that skywalking intercepts {@link
* com.mongodb.DBCollection#find()}, {@link com.mongodb.DBCollection#createIndex} by using {@link
* MongoDBCollectionMethodInterceptor}.
* {@link MongoDBCollectionImplInstrumentation} define that the MongoDB Java Driver 2.13.x-2.14.x plugin intercepts the following methods in the
* {@link com.mongodb.DBCollectionImpl}class:
* 1. find <br/>
* 2. insert <br/>
* 3. insertImpl <br/>
* 4. update <br/>
* 5. updateImpl <br/>
* 6. remove <br/>
* 7. createIndex <br/>
*
*/
public class MongoDBCollectionImplInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {

View File

@ -31,9 +31,20 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import static org.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link MongoDBCollectionInstrumentation} presents that skywalking intercepts {@link com.mongodb.DBCollection#getCount()},
* {@link com.mongodb.DBCollection#mapReduce} by using {@link MongoDBCollectionMethodInterceptor}.
* {@link MongoDBCollectionInstrumentation} define that the MongoDB Java Driver 2.13.x-2.14.x plugin intercepts the following methods in the
* {@link com.mongodb.DBCollection}class:
* 1. aggregate <br/>
* 2. findAndModify <br/>
* 3. getCount <br/>
* 4. drop <br/>
* 5. dropIndexes <br/>
* 6. rename <br/>
* 7. group <br/>
* 8. distinct <br/>
* 9. mapReduce <br/>
*
*/
public class MongoDBCollectionInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
@ -136,12 +147,6 @@ public class MongoDBCollectionInstrumentation extends ClassInstanceMethodsEnhanc
return named("mapReduce").and(takesArgumentWithType(0, "com.mongodb.DBObject"));
}
},
new InterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named("aggregate").and(takesArgumentWithType(1, "com.mongodb.ReadPreference"));
}
},
new InterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {