[DOCS-15501] Setting a filter with db.setProfilingLevel(2) is not working Created: 25/Jul/22  Updated: 13/Nov/23  Resolved: 01/Aug/22

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.4.0, 5.0.0, 6.0.0, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Improvement Priority: Minor - P4
Reporter: Peter Oh Assignee: Jason Price
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 1 year, 27 weeks, 2 days ago
Epic Link: DOCSP-11701
Story Points: 3

 Description   

Hello team,

The below example is misleading, I have found out that this example is not working.

 

For example, the following db.setProfilingLevel() method sets for a mongod instance:

  • the profiling level to 2,
  • the filter of { op: "query", millis: { $gt: 2000 }}, which causes the profiler to only log query operations that took longer than 2 seconds.

db.setProfilingLevel( 2, { filter: { op: "query", millis: { $gt: 2000 } } } )

To me, the filter for Data Profiler works with db.setProfilingLevel( 1 ) only.

db.setProfilingLevel( 1, { filter: { op: "query", millis: { $gt: 2000 } } } )

 

Which makes sense with the below description 

 

Level Description
0 The profiler is off and does not collect any data. This is the default profiler level.
1 The profiler collects data for operations that take longer than the value of slowms or that match a filter.
When a filter is set:
  • The slowms and sampleRate options are not used for profiling.
  • The profiler only captures operations that match the filter.
2 The profiler collects data for all operations.

 

https://www.mongodb.com/docs/manual/tutorial/manage-the-database-profiler/#database-profiler

Can you please check this out and rectify the example?



 Comments   
Comment by Githook User [ 01/Aug/22 ]

Author:

{'name': 'jason-price-mongodb', 'email': '69260375+jason-price-mongodb@users.noreply.github.com', 'username': 'jason-price-mongodb'}

Message: DOCS-15501-filter-with-profile (#1525) (#1542)

Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>

Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
Branch: v5.0
https://github.com/10gen/docs-mongodb-internal/commit/b9c36a98121df274421ad0f71c7213e67605681d

Comment by Githook User [ 01/Aug/22 ]

Author:

{'name': 'jason-price-mongodb', 'email': '69260375+jason-price-mongodb@users.noreply.github.com', 'username': 'jason-price-mongodb'}

Message: DOCS-15501-filter-with-profile (#1525)

Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
Branch: master
https://github.com/10gen/docs-mongodb-internal/commit/50c5acbbdf0676314c153669e7a90d4b72e86938

Generated at Thu Feb 08 08:13:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.