diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/pom.xml new file mode 100644 index 000000000..ae5b8d77e --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/pom.xml @@ -0,0 +1,71 @@ + + + + + + apm-sdk-plugin + org.skywalking + 3.2.5-2017 + + 4.0.0 + + apm-mongodb-2.x-plugin + jar + + + UTF-8 + + + + + org.mongodb + mongo-java-driver + 2.14.2 + provided + + + org.mongodb + bson + 2.14.2 + provided + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + + attach-sources + + jar + + + + + + + \ No newline at end of file diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/MongoDBCollectionMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/MongoDBCollectionMethodInterceptor.java new file mode 100644 index 000000000..376d29c90 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/MongoDBCollectionMethodInterceptor.java @@ -0,0 +1,102 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.plugin.mongodb.v2; + +import com.mongodb.AggregationOutput; +import com.mongodb.CommandResult; +import com.mongodb.DB; +import com.mongodb.ServerAddress; +import com.mongodb.WriteResult; +import java.lang.reflect.Method; +import java.util.List; +import org.skywalking.apm.agent.core.context.ContextCarrier; +import org.skywalking.apm.agent.core.context.ContextManager; +import org.skywalking.apm.agent.core.context.tag.Tags; +import org.skywalking.apm.agent.core.context.trace.AbstractSpan; +import org.skywalking.apm.agent.core.context.trace.SpanLayer; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.skywalking.apm.network.trace.component.ComponentsDefine; + +/** + * {@link MongoDBCollectionMethodInterceptor} intercepts constructor of {@link com.mongodb.DBCollection}or {@link + * com.mongodb.DBCollectionImpl} recording the ServerAddress and creating the exit span. + * + * @author liyuntao + */ + +public class MongoDBCollectionMethodInterceptor implements InstanceMethodsAroundInterceptor, InstanceConstructorInterceptor { + + private static final String DB_TYPE = "MongoDB"; + + private static final String MONGO_DB_OP_PREFIX = "MongoDB/"; + + @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, + Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + + String remotePeer = (String)objInst.getSkyWalkingDynamicField(); + String opertaion = method.getName(); + AbstractSpan span = ContextManager.createExitSpan(MONGO_DB_OP_PREFIX + opertaion, new ContextCarrier(), remotePeer); + span.setComponent(ComponentsDefine.MONGODB); + Tags.DB_TYPE.set(span, DB_TYPE); + SpanLayer.asDB(span); + + } + + @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, + Class[] argumentsTypes, Object ret) throws Throwable { + AbstractSpan activeSpan = ContextManager.activeSpan(); + CommandResult cresult = null; + if (ret instanceof WriteResult) { + WriteResult wresult = (WriteResult)ret; + cresult = wresult.getCachedLastError(); + } else if (ret instanceof AggregationOutput) { + AggregationOutput aresult = (AggregationOutput)ret; + cresult = aresult.getCommandResult(); + } + if (null != cresult && !cresult.ok()) { + activeSpan.log(cresult.getException()); + } + ContextManager.stopSpan(); + return ret; + } + + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, + Class[] argumentsTypes, Throwable t) { + AbstractSpan activeSpan = ContextManager.activeSpan(); + activeSpan.errorOccurred(); + activeSpan.log(t); + } + + @Override + public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { + List servers = null; + DB db = (DB)allArguments[0]; + servers = db.getMongo().getAllAddress(); + StringBuilder peers = new StringBuilder(); + for (ServerAddress address : servers) { + peers.append(address.getHost() + ":" + address.getPort() + ";"); + } + + objInst.setSkyWalkingDynamicField(peers.subSequence(0, peers.length() - 1).toString()); + } + +} diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/InterceptPoint.java b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/InterceptPoint.java new file mode 100644 index 000000000..01ddb6081 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/InterceptPoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.plugin.mongodb.v2.define; + +import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; + +/** + * @auther liyuntao + */ +public abstract class InterceptPoint implements InstanceMethodsInterceptPoint { + private static final String MONGDB_METHOD_INTERCET_CLASS = "org.skywalking.apm.plugin.mongodb.v2.MongoDBCollectionMethodInterceptor"; + + @Override + public String getMethodsInterceptor() { + return MONGDB_METHOD_INTERCET_CLASS; + } + + @Override + public boolean isOverrideArgs() { + return false; + } +} diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/MongoDBCollectionImplInstrumentation.java b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/MongoDBCollectionImplInstrumentation.java new file mode 100644 index 000000000..47213d615 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/MongoDBCollectionImplInstrumentation.java @@ -0,0 +1,140 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.plugin.mongodb.v2.define; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static net.bytebuddy.matcher.ElementMatchers.any; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; +import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName; + +/** + * {@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
+ * 2. insert
+ * 3. insertImpl
+ * 4. update
+ * 5. updateImpl
+ * 6. remove
+ * 7. createIndex
+ * + * @author liyuntao + */ +public class MongoDBCollectionImplInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + private static final String ENHANCE_CLASS = "com.mongodb.DBCollectionImpl"; + + private static final String MONGDB_METHOD_INTERCET_CLASS = "org.skywalking.apm.plugin.mongodb.v2.MongoDBCollectionMethodInterceptor"; + + @Override + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[] { + new ConstructorInterceptPoint() { + @Override + public ElementMatcher getConstructorMatcher() { + return any(); + } + + @Override + public String getConstructorInterceptor() { + return MONGDB_METHOD_INTERCET_CLASS; + } + } + }; + } + + @Override + protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[] { + + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("find").and(takesArguments(9)); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("insert").and(takesArguments(4)); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("insertImpl"); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("update"); + } + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("updateImpl"); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("remove").and(takesArguments(4)); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("createIndex"); + } + + }, + + }; + } + + @Override + protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); + } + + @Override + protected String[] witnessClasses() { + /** + * @see {@link com.mongodb.tools.ConnectionPoolStat} + */ + return new String[] { + "com.mongodb.tools.ConnectionPoolStat" + }; + } + +} diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/MongoDBCollectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/MongoDBCollectionInstrumentation.java new file mode 100644 index 000000000..70da4a3b5 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/java/org/skywalking/apm/plugin/mongodb/v2/define/MongoDBCollectionInstrumentation.java @@ -0,0 +1,173 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.plugin.mongodb.v2.define; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static net.bytebuddy.matcher.ElementMatchers.any; +import static net.bytebuddy.matcher.ElementMatchers.named; +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} 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
+ * 2. findAndModify
+ * 3. getCount + *
+ * 4. drop
+ * 5. dropIndexes
+ * 6. rename
+ * 7. group
+ * 8. distinct
+ * 9. mapReduce
+ * + * @author liyuntao + */ +public class MongoDBCollectionInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + private static final String ENHANCE_CLASS = "com.mongodb.DBCollection"; + + private static final String MONGDB_METHOD_INTERCET_CLASS = "org.skywalking.apm.plugin.mongodb.v2.MongoDBCollectionMethodInterceptor"; + + @Override + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[] { + new ConstructorInterceptPoint() { + @Override + public ElementMatcher getConstructorMatcher() { + return any(); + } + + @Override + public String getConstructorInterceptor() { + return MONGDB_METHOD_INTERCET_CLASS; + } + } + }; + } + + @Override + protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[] { + + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("aggregate").and(takesArgumentWithType(1, "com.mongodb.ReadPreference")); + } + }, + + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("findAndModify").and(takesArguments(9)); + } + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("getCount").and(takesArgumentWithType(6, "java.util.concurrent.TimeUnit")); + } + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("drop"); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("dropIndexes"); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("rename").and(takesArgumentWithType(1, "boolean")); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("group").and(takesArgumentWithType(1, "boolean")); + } + + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("group").and(takesArgumentWithType(1, "com.mongodb.DBObject")); + } + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("distinct").and(takesArgumentWithType(2, "com.mongodb.ReadPreference")); + } + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("mapReduce").and(takesArgumentWithType(0, "com.mongodb.MapReduceCommand")); + } + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("mapReduce").and(takesArgumentWithType(0, "com.mongodb.DBObject")); + } + }, + new InterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("explainAggregate"); + } + }, + + }; + } + + @Override + protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); + } + + @Override + protected String[] witnessClasses() { + /** + * @see {@link com.mongodb.tools.ConnectionPoolStat} + */ + return new String[] { + "com.mongodb.tools.ConnectionPoolStat" + }; + } + +} diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/resources/skywalking-plugin.def new file mode 100644 index 000000000..fb8a07eab --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/main/resources/skywalking-plugin.def @@ -0,0 +1,2 @@ +mongodb-2.x=org.skywalking.apm.plugin.mongodb.v2.define.MongoDBCollectionInstrumentation +mongodb-2.x=org.skywalking.apm.plugin.mongodb.v2.define.MongoDBCollectionImplInstrumentation diff --git a/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/test/java/org/skywalking/apm/plugin/mongodb/v2/MongoDBCollectionMethodInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/test/java/org/skywalking/apm/plugin/mongodb/v2/MongoDBCollectionMethodInterceptorTest.java new file mode 100644 index 000000000..28f0805a4 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/src/test/java/org/skywalking/apm/plugin/mongodb/v2/MongoDBCollectionMethodInterceptorTest.java @@ -0,0 +1,125 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.plugin.mongodb.v2; + +import com.mongodb.DBCollection; +import com.mongodb.DBObject; +import java.lang.reflect.Method; +import java.util.List; +import org.hamcrest.MatcherAssert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.powermock.modules.junit4.PowerMockRunner; +import org.powermock.modules.junit4.PowerMockRunnerDelegate; +import org.skywalking.apm.agent.core.conf.Config; +import org.skywalking.apm.agent.core.context.trace.AbstractTracingSpan; +import org.skywalking.apm.agent.core.context.trace.LogDataEntity; +import org.skywalking.apm.agent.core.context.trace.SpanLayer; +import org.skywalking.apm.agent.core.context.trace.TraceSegment; +import org.skywalking.apm.agent.core.context.util.KeyValuePair; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.skywalking.apm.agent.test.helper.SegmentHelper; +import org.skywalking.apm.agent.test.helper.SpanHelper; +import org.skywalking.apm.agent.test.tools.AgentServiceRule; +import org.skywalking.apm.agent.test.tools.SegmentStorage; +import org.skywalking.apm.agent.test.tools.SegmentStoragePoint; +import org.skywalking.apm.agent.test.tools.TracingSegmentRunner; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.when; +import static org.skywalking.apm.agent.test.tools.SpanAssert.assertException; + +@RunWith(PowerMockRunner.class) +@PowerMockRunnerDelegate(TracingSegmentRunner.class) +public class MongoDBCollectionMethodInterceptorTest { + + @SegmentStoragePoint + private SegmentStorage segmentStorage; + + @Rule + public AgentServiceRule serviceRule = new AgentServiceRule(); + + private MongoDBCollectionMethodInterceptor interceptor; + + @Mock + private EnhancedInstance enhancedInstance; + + private Object[] arguments = new Object[3]; + private Class[] argumentTypes; + + @SuppressWarnings({"rawtypes", "unchecked"}) + @Before + public void setUp() throws Exception { + + interceptor = new MongoDBCollectionMethodInterceptor(); + + Config.Plugin.MongoDB.TRACE_PARAM = true; + + when(enhancedInstance.getSkyWalkingDynamicField()).thenReturn("127.0.0.1:27017"); + + } + + @Test + public void testIntercept() throws Throwable { + interceptor.beforeMethod(enhancedInstance, getExecuteMethod(), null, null, null); + interceptor.afterMethod(enhancedInstance, getExecuteMethod(), null, null, null); + + MatcherAssert.assertThat(segmentStorage.getTraceSegments().size(), is(1)); + TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0); + List spans = SegmentHelper.getSpans(traceSegment); + assertMongoSpan(spans.get(0)); + } + + @Test + public void testInterceptWithException() throws Throwable { + interceptor.beforeMethod(enhancedInstance, getExecuteMethod(), null, null, null); + interceptor.handleMethodException(enhancedInstance, getExecuteMethod(), null, null, new RuntimeException()); + interceptor.afterMethod(enhancedInstance, getExecuteMethod(), null, null, null); + + MatcherAssert.assertThat(segmentStorage.getTraceSegments().size(), is(1)); + TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0); + List spans = SegmentHelper.getSpans(traceSegment); + assertMongoSpan(spans.get(0)); + List logDataEntities = SpanHelper.getLogs(spans.get(0)); + assertThat(logDataEntities.size(), is(1)); + assertException(logDataEntities.get(0), RuntimeException.class); + } + + private void assertMongoSpan(AbstractTracingSpan span) { + assertThat(span.getOperationName(), is("MongoDB/insert")); + assertThat(SpanHelper.getComponentId(span), is(9)); + List tags = SpanHelper.getTags(span); + assertThat(tags.get(0).getValue(), is("MongoDB")); + assertThat(span.isExit(), is(true)); + assertThat(SpanHelper.getLayer(span), is(SpanLayer.DB)); + } + + private Method getExecuteMethod() { + try { + return DBCollection.class.getMethod("insert", DBObject[].class); + } catch (NoSuchMethodException e) { + return null; + } + } + +} diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml index fe2335214..1cccd9a02 100644 --- a/apm-sniffer/apm-sdk-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/pom.xml @@ -52,6 +52,7 @@ h2-1.x-plugin postgresql-8.x-plugin oracle-10.x-plugin + mongodb-2.x-plugin pom