1

我想mongodb使用JProfiler. 我构建了一个简单的 groovy 脚本,它使用com.mongodb驱动程序连接到mongodb数据库并触发一些查询。

我按照此视频中的说明配置了 JProfiler: http ://blog.ej-technologies.com/2013/07/profiling-mongodb.html

我的脚本很简单,但是我在 JProfiler 的 mongodb 选项卡中看不到任何调用。

println "Starting client "+getName()
Mongo mongo = new Mongo("mongohost", 27017)
DB db = mongo.getDB("databasename")

// get a single collection
DBCollection collection = db.getCollection("collectionname")

DBCursor cursor = collection.find()
while (cursor.hasNext()) {
cursor.next()
}
println "Client "+getName() + " finished"

你知道我错过了什么吗?

编辑:该死的......我仔细检查了 JProfiler 文档并错过了这个条目:

MongoDB 探针与从 2.11 及更高版本开始的官方 MongoDB 驱动程序一起使用。

因此,我将 pom 中的条目更改为 2.11.3 版本,现在一切正常。

4

1 回答 1

0

您可以通过将 JProfiler 集成到 IDE 来进行分析。在下面的链接中,它显示了如何将其连接到 IntelliJ。

https://medium.com/@ydulanjanii/profiling-mongodb-with-jprofiler-e3aef8860265

于 2019-10-03T09:53:37.803 回答