This repository has been archived by the owner on Jul 9, 2022. It is now read-only.
forked from cloudy-native/insight-plugin-mongodb
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO - Tests on the aspects - ftl tests and fixups for the new operations - manual testing with a suitably mongoish webapp
- Loading branch information
jkew
committed
Sep 29, 2011
1 parent
209268f
commit 3eddc2d
Showing
3 changed files
with
57 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 13 additions & 6 deletions
19
src/main/java/org/harrison/insight/plugin/mongodb/MongoDbOperationCollectionAspect.aj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
package org.harrison.insight.plugin.mongodb; | ||
|
||
import com.springsource.insight.intercept.operation.OperationList; | ||
import com.springsource.insight.intercept.operation.OperationType; | ||
import org.aspectj.lang.JoinPoint; | ||
|
||
import com.mongodb.CommandResult; | ||
import com.mongodb.DB; | ||
import com.springsource.insight.collection.AbstractOperationCollectionAspect; | ||
import com.springsource.insight.intercept.operation.Operation; | ||
|
||
public aspect MongoDbOperationCollectionAspect extends | ||
AbstractOperationCollectionAspect { | ||
import java.util.List; | ||
|
||
public aspect MongoDbOperationCollectionAspect extends AbstractOperationCollectionAspect { | ||
|
||
public static final OperationType TYPE = OperationType.valueOf("mongo_db_operation"); | ||
|
||
public pointcut collectionPoint(): execution(CommandResult DB.command(..)); | ||
|
||
@Override | ||
protected Operation createOperation(final JoinPoint joinPoint) { | ||
Operation op = new Operation(); | ||
Operation op = new Operation().label("MongoDB: DB." + joinPoint.getSignature().getName() + "()").type(TYPE); | ||
OperationList opList = op.createList("args"); | ||
List<String> args = ArgUtils.toString(joinPoint.getArgs()); | ||
for (String arg : args) { | ||
opList.add(arg); | ||
} | ||
return op; | ||
return new MongoDbOperation(getSourceCodeLocation(joinPoint), joinPoint | ||
.getSignature().getName(), ArgUtils.toString(joinPoint | ||
.getArgs())); | ||
} | ||
} |