Skip to content

Conversation

@ShaneHarvey
Copy link
Member

See the docs here: https://docs.mongodb.com/manual/reference/command/profile/

sampleRate was added in 3.6.
filter was added in 4.4.2.

Filter is a bit odd in that it accepts a query document OR the string "unset" which resets and disables the filter. For this reason I decided not to perform client-side type validation on the filter parameter.

I also decided not to add **kwargs. Adding **kwargs let's users do strange things like pass arbitrary command arguments (txnNumber, lsid, writeConcern, etc..) and makes the code more confusing since we then need to define (or at least think about) precedence in cases like this: db.set_profiling_level(ALL, slow_ms=50, slowms=55)

Copy link
Contributor

@prashantmital prashantmital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM but given that there is no driver spec for this command, is this something we want to remove in PyMongo 4.0? If so, can we:

  • Change the base branch to merge this change to v3.12
  • Add a deprecation warning to this helper either here or open a ticket to deprecate it in 3.12
  • Open a ticket to remove the profiling helper in PyMongo 4.0

@ShaneHarvey
Copy link
Member Author

I opened https://jira.mongodb.org/browse/PYTHON-2662 to investigate the deprecation idea.

@ShaneHarvey ShaneHarvey merged commit a44e719 into mongodb:master Apr 28, 2021
ShaneHarvey added a commit that referenced this pull request Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants