0

我们有个应用使用mongoDb做操作日志的查询,偶尔会有server端执行超时的问题。在具体方案的过程中,偶尔发现mongo输出的日志中有关于执行耗时的信息,但是找不到这块代码在哪,所以无法判定mongo是怎么计算这个执行时间的。整体依赖信息如下:

mongoDriver的依赖:

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>3.12.7</version>
</dependency>

spring 集成的mongo,使用的spring版本:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-mongodb</artifactId>
    <version>1.10.23.RELEASE</version>
</dependency>

日志输出截取部分信息如下:
(1)org.springframework.data.mongodb.core.MongoDbUtilsGetting Mongo Database name=[resource_log0]
(2)org.mongodb.driver.protocol.commandSending command '{"count": "operation_log_79", "query": {"$and": [{"user_id": 62700030514190}], "product_code": {"$in": ["1", "2", "3", "5", "7", "8", "17"]}, "operate_type": {"$in": [-1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 917]}, "operate_at": {"$gte": 1537919200000, "$lte": 1598602992680}}, "$db": "mdb58_resource_log0", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1601026038, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "w6jXTLh0zzMWKYmK3ZKHioB6frs=", "subType": "00"}}, "keyId": 6860731357916561409}}, "lsid": {"id": {"$binary": {"base64": "pxBt02ITR+2JewwqdR0T8w==", "subType": "04"}}}, "$readPreference": {"mode": "secondaryPreferred"}}' with request id 195 to database resource_log0 on connection [connectionId{localValue:26, serverValue:202838}] to server 10.166.254.150:57027
(3)org.mongodb.driver.protocol.commandExecution of command with request id 195 completed successfully in 513.02 ms on connection [connectionId{localValue:26, serverValue:202838}] to server 10.166.254.150:57027

问题: 第(3)行日志中所打印出来的执行耗时这个是怎么统计的?这块统计代码在哪能找打,我找完了driver包和spring包都没找到这段代码。
     希望各位小伙伴给下提示,多谢.
Changed status to publish