8000 feat: finer frappe Recorder control with decorator by ankush · Pull Request #19220 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: finer frappe Recorder control with decorator #19220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2022

Conversation

ankush
Copy link
Member
@ankush ankush commented Dec 9, 2022

Currently frappe recorder can be enabled globally and profiles every
request. This is often way too much info. If you already know where
problem lies you use this decorator sparingly to only profile relevant
functions.

Usage:

from frappe.recorder import record_queries

@record_queries
def sus_slow_function():
    frappe.db.sql("select everything from everywhere")

For interactive debugging you can wrap any function at runtime (that's all decorators do)

>>> from frappe.recorder import record_queries
>>> f = record_queries(your_slow_function)
>>> f(*args, *kwargs)

This is a tool for debugging, don't leave this in code. It will make your code horribly slow.

no-docs - not stable yet.

8000
@ankush ankush requested review from a team and shariquerik and removed request for a team December 9, 2022 08:00
@codecov
Copy link
codecov bot commented Dec 9, 2022

Codecov Report

Merging #19220 (890ed67) into develop (77ce90d) will increase coverage by 0.02%.
The diff coverage is 87.09%.

❗ Current head 890ed67 differs from pull request most recent head 005a828. Consider uploading reports for the commit 005a828 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #19220      +/-   ##
===========================================
+ Coverage    64.10%   64.13%   +0.02%     
===========================================
  Files          751      751              
  Lines        68898    68960      +62     
  Branches      6041     6041              
===========================================
+ Hits         44168    44227      +59     
- Misses       21301    21304       +3     
  Partials      3429     3429              
Flag Coverage Δ
server 68.45% <82.14%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Currently frappe recorder can be enabled globally and profiles every
request. This is often way too much info. If you already know where
problem lies you use this decorator sparingly to only profile relevant
functions.

Usage:
```py
from frappe.recorder import record_queries

@record_queries
def sus_slow_function():
    frappe.db.sql("select everything from everywhere")
```
@ankush ankush force-pushed the recorder_decorator branch from 890ed67 to 005a828 Compare December 9, 2022 08:20
@ankush ankush merged commit ec3f705 into frappe:develop Dec 9, 2022
@ankush ankush deleted the recorder_decorator branch December 9, 2022 08:48
mergify bot pushed a commit that referenced this pull request Dec 9, 2022
Currently frappe recorder can be enabled globally and profiles every
request. This is often way too much info. If you already know where
problem lies you use this decorator sparingly to only profile relevant
functions.

Usage:
```py
from frappe.recorder import record_queries

@record_queries
def sus_slow_function():
    frappe.db.sql("select everything from everywhere")
```

(cherry picked from commit ec3f705)
mergify bot pushed a commit that referenced this pull request Dec 9, 2022
Currently frappe recorder can be enabled globally and profiles every
request. This is often way too much info. If you already know where
problem lies you use this decorator sparingly to only profile relevant
functions.

Usage:
```py
from frappe.recorder import record_queries

@record_queries
def sus_slow_function():
    frappe.db.sql("select everything from everywhere")
```

(cherry picked from commit ec3f705)
ankush added a commit that referenced this pull request Dec 9, 2022
Currently frappe recorder can be enabled globally and profiles every
request. This is often way too much info. If you already know where
problem lies you use this decorator sparingly to only profile relevant
functions.

Usage:
```py
from frappe.recorder import record_queries

@record_queries
def sus_slow_function():
    frappe.db.sql("select everything from everywhere")
```

(cherry picked from commit ec3f705)

Co-authored-by: Ankush Menat <ankush@frappe.io>
ankush added a commit that referenced this pull request Dec 9, 2022
…19221)

* feat: finer frappe Recorder control with decorator (#19220)

Currently frappe recorder can be enabled globally and profiles every
request. This is often way too much info. If you already know where
problem lies you use this decorator sparingly to only profile relevant
functions.

Usage:
```py
from frappe.recorder import record_queries

@record_queries
def sus_slow_function():
    frappe.db.sql("select everything from everywhere")
```

(cherry picked from commit ec3f705)

* Update test_recorder.py

Co-authored-by: Ankush Menat <ankush@frappe.io>
frappe-pr-bot pushed a commit that referenced this pull request Dec 13, 2022
# [14.19.0](v14.18.1...v14.19.0) (2022-12-13)

### Bug Fixes

* allow changing counter for prefix-less series ([#19180](#19180)) ([#19190](#19190)) ([a2a91bb](a2a91bb))
* child table not working ([e1b231a](e1b231a))
* do not rename select field options and values on doctype rename ([#19223](#19223)) ([#19226](#19226)) ([f511dfc](f511dfc))
* **docshare:** return None if share_name and value are None ([#19187](#19187)) ([#19189](#19189)) ([b8541e9](b8541e9))
* log unknown usernames too for failed attempts ([#19199](#19199)) ([#19201](#19201)) ([6db0b8a](6db0b8a))
* only make fetch_from field read only if no input ([#19192](#19192)) ([#19195](#19195)) ([17e8aa5](17e8aa5))
* reload shared dialog upon checking any perm ([#19196](#19196)) ([#19198](#19198)) ([cfa6ec2](cfa6ec2))
* set-config -g ([#19217](#19217)) ([#19219](#19219)) ([2fd7af7](2fd7af7))
* stabilize shared with dialog ([#19186](#19186)) ([c013d11](c013d11))
* TypeError when using frappe.throw() or frappe.msgprint() with lists ([#19255](#19255)) ([#19256](#19256)) ([0748324](0748324))
* unscrub and translate field names in tooltip explaining fetch from (backport [#19143](#19143)) ([#19174](#19174)) ([018984e](018984e))
* untranslated link fields in list view ([#19155](#19155)) ([4296681](4296681))
* **UX:** forget password shows error on wrong email ([#19235](#19235)) ([#19240](#19240)) ([ac1ca50](ac1ca50))
* validate parentfield while checking child perms ([a9871b2](a9871b2))
* workflow icon not visible in mobile view ([388a919](388a919))

### Features

* allow user to pick all columns ([#19236](#19236)) ([16a1253](16a1253))
* finer frappe Recorder control with decorator ([#19220](#19220)) ([#19222](#19222)) ([4402f12](4402f12))
* inter-process file locks (backport [#19133](#19133)) ([#19142](#19142)) ([c407dae](c407dae))

### Performance Improvements

* remove order_by from linked_with checks ([#19229](#19229)) ([#19243](#19243)) ([3fa0207](3fa0207))
frappe-pr-bot pushed a commit that referenced this pull request Dec 13, 2022
# [13.46.0](v13.45.3...v13.46.0) (2022-12-13)

### Bug Fixes

* attribute error on export of reports with additional columns ([#19105](#19105)) ([#19119](#19119)) ([da28290](da28290))
* do not rename select field options and values on doctype rename ([#19223](#19223)) ([#19225](#19225)) ([47f5fd0](47f5fd0))
* **docshare:** return None if share_name and value are None ([#19187](#19187)) ([#19188](#19188)) ([4e2620a](4e2620a))
* log unknown usernames too for failed attempts ([#19199](#19199)) ([#19200](#19200)) ([a75fa10](a75fa10))
* only make fetch_from field read only if no input (backport [#19192](#19192)) ([#19194](#19194)) ([994c1ed](994c1ed))
* reload shared dialog upon checking any perm (backport [#19196](#19196)) ([#19197](#19197)) ([fd44b34](fd44b34))
* set-config -g ([#19217](#19217)) ([#19218](#19218)) ([458707e](458707e))
* stabilize shared with dialog (backport [#19170](#19170)) ([#19185](#19185)) ([4f9d755](4f9d755))
* unscrub and translate field names in tooltip explaining fetch from (backport [#19143](#19143)) ([#19173](#19173)) ([fc430d1](fc430d1))
* **UX:** forget password shows error on wrong email ([#19235](#19235)) ([#19239](#19239)) ([5257ca7](5257ca7))
* workflow icon not visible in mobile view ([dcb3933](dcb3933))

### Features

* allow user to pick all columns ([#19236](#19236)) ([927b264](927b264))
* finer frappe Recorder control with decorator (backport [#19220](#19220)) ([#19221](#19221)) ([3b18e7e](3b18e7e))
* inter-process file locks ([#19133](#19133)) ([#19145](#19145)) ([b34e8ce](b34e8ce))

### Performance Improvements

* remove order_by from linked_with checks ([#19229](#19229)) ([#19242](#19242)) ([c2cde0c](c2cde0c))
SaiFi0102 pushed a commit to ParaLogicTech/frappe that referenced this pull request Dec 16, 2022
…appe#19222)

Currently frappe recorder can be enabled globally and profiles every
request. This is often way too much info. If you already know where
problem lies you use this decorator sparingly to only profile relevant
functions.

Usage:
```py
from frappe.recorder import record_queries

@record_queries
def sus_slow_function():
    frappe.db.sql("select everything from everywhere")
```

(cherry picked from commit ec3f705)

Co-authored-by: Ankush Menat <ankush@frappe.io>
SaiFi0102 pushed a commit to ParaLogicTech/frappe that referenced this pull request Dec 16, 2022
# [14.19.0](frappe/frappe@v14.18.1...v14.19.0) (2022-12-13)

### Bug Fixes

* allow changing counter for prefix-less series ([frappe#19180](frappe#19180)) ([frappe#19190](frappe#19190)) ([a2a91bb](frappe@a2a91bb))
* child table not working ([e1b231a](frappe@e1b231a))
* do not rename select field options and values on doctype rename ([frappe#19223](frappe#19223)) ([frappe#19226](frappe#19226)) ([f511dfc](frappe@f511dfc))
* **docshare:** return None if share_name and value are None ([frappe#19187](frappe#19187)) ([frappe#19189](frappe#19189)) ([b8541e9](frappe@b8541e9))
* log unknown usernames too for failed attempts ([frappe#19199](frappe#19199)) ([frappe#19201](frappe#19201)) ([6db0b8a](frappe@6db0b8a))
* only make fetch_from field read only if no input ([frappe#19192](frappe#19192)) ([frappe#19195](frappe#19195)) ([17e8aa5](frappe@17e8aa5))
* reload shared dialog upon checking any perm ([frappe#19196](frappe#19196)) ([frappe#19198](frappe#19198)) ([cfa6ec2](frappe@cfa6ec2))
* set-config -g ([frappe#19217](frappe#19217)) ([frappe#19219](frappe#19219)) ([2fd7af7](frappe@2fd7af7))
* stabilize shared with dialog ([frappe#19186](frappe#19186)) ([c013d11](frappe@c013d11))
* TypeError when using frappe.throw() or frappe.msgprint() with lists ([frappe#19255](frappe#19255)) ([frappe#19256](frappe#19256)) ([0748324](frappe@0748324))
* unscrub and translate field names in tooltip explaining fetch from (backport [frappe#19143](frappe#19143)) ([frappe#19174](frappe#19174)) ([018984e](frappe@018984e))
* untranslated link fields in list view ([frappe#19155](frappe#19155)) ([4296681](frappe@4296681))
* **UX:** forget password shows error on wrong email ([frappe#19235](frappe#19235)) ([frappe#19240](frappe#19240)) ([ac1ca50](frappe@ac1ca50))
* validate parentfield while checking child perms ([a9871b2](frappe@a9871b2))
* workflow icon not visible in mobile view ([388a919](frappe@388a919))

### Features

* allow user to pick all columns ([frappe#19236](frappe#19236)) ([16a1253](frappe@16a1253))
* finer frappe Recorder control with decorator ([frappe#19220](frappe#19220)) ([frappe#19222](frappe#19222)) ([4402f12](frappe@4402f12))
* inter-process file locks (backport [frappe#19133](frappe#19133)) ([frappe#19142](frappe#19142)) ([c407dae](frappe@c407dae))

### Performance Improvements

* remove order_by from linked_with checks ([frappe#19229](frappe#19229)) ([frappe#19243](frappe#19243)) ([3fa0207](frappe@3fa0207))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2022
@NagariaHussain
Copy link
Member

Stable for docs now @ankush ?

@ankush
Copy link
Member Author
ankush commented Sep 25, 2023

@NagariaHussain I've not used it ever since 😆 but feel free to put it in doc, I have no intention to remove it. It might be handy some day.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0