[SERVER-3848] Log doc during insert in system.profile collection Created: 14/Sep/11  Updated: 06/Dec/22  Resolved: 22/Aug/19

Status: Closed
Project: Core Server
Component/s: Admin, Performance
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 5
Labels: profiling
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-3847 db.setProfilingLevel(2) doesn't log w... Closed
Assigned Teams:
Query
Participants:

 Description   

Allow profiling to log data for inserts.

This should not be the default as it makes little sense to duplicate all that data but there are use cases during debugging when the values in the inserted document affect performance.



 Comments   
Comment by Charlie Swanson [ 22/Aug/19 ]

This may still be a problem for OP_INSERT but we don't plan on fixing it if that's the case.

Comment by Alexander Ravikovich [ 12/Aug/19 ]

I know this is a very old ticket... but still, will try to get an answer...

On the v3.4.10 for the query

db.mycollection.insert({
    name: "alex"
})

I have a log like (see the "query" part)

{ "op": "insert", "ns": "mydb.mycollection", "query": { "insert": "mycollection", "documents": [ { "_id": "5d5186e11a65df05fa735418", "name": "alex" } ], "ordered": true }, "ninserted": 1, "keysInserted": 10, "numYield": 0, "locks": { "Global": { "acquireCount": { "r": 1, "w": 1 } }, "Database": { "acquireCount": { "w": 1 } }, "Collection": { "acquireCount": { "w": 1 } } }, "responseLength": 44, "protocol": "op_query", "millis": 0,..." }

The same query on the v4.0.11 doesn't include the "query" part:

{ "op": "insert", "ns": "mydb.mycollection", "command": { "insert": "mycollection", "ordered": true, "$db": "mydb" }, "ninserted": 1, "keysInserted": 1, "numYield": 0, "locks": { "Global": { "acquireCount": { "r": 3, "w": 3 } }, "Database": { "acquireCount": { "w": 2, "W": 1 } }, "Collection": { "acquireCount": { "w": 2 } } }, "responseLength": 245, "protocol": "op_query", "millis": 7, .... }

Is it an bug? feature?

Comment by Ivan Artemov [ 22/Aug/17 ]

We have many insert workloads and sometimes, when we see system.profile collection is empty - it's not normal.
We need to monitor current MongoDB state for all operation types

Comment by Russell Smith [ 14/Sep/11 ]

FYI anyone with the need to log inserts, you can parse the output from mongosniff : http://www.mongodb.org/display/DOCS/mongosniff

Comment by Russell Smith [ 14/Sep/11 ]

In the case of inserts, it would make sense to allow the profiling log to do one or more of the following;

  • To be inserted in to specific db / collection
  • To be per enabled per collection
  • To exclude inserts in to the system.profile
Generated at Thu Feb 08 03:04:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.