Commit graph

23 commits

Author SHA1 Message Date
Ankush Menat
df2b9c0983
fix(recorder): handle frappe.db.sql(run=0) (#25450) 2024-03-14 17:47:37 +00:00
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
d5d9b12472
test: flaky server tests (#24301)
* Revert "fix(test_recorder): get the correct request (#24143)"

This reverts commit 745080c56e.

* test: disable recording before running assertions

* test: Dont set emails in test for broken email setup
2024-01-15 08:09:46 +00:00
Akhil Narang
745080c56e
fix(test_recorder): get the correct request (#24143)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-06 09:42:53 +05:30
Ankush Menat
3916398f1a
fix(recorder): Normalize IN in SQL queries (#24132) 2024-01-04 19:08:59 +05:30
Ankush Menat
59e49d89fe feat: include Trace ID in all SQL queries 2023-08-23 13:59:24 +05:30
Ankush Menat
42aff950ce
feat(DX): normalize queries in recorder (#21735)
Attempt to normalize query by removing "variables"
This gives a different view of similar duplicate queries.

These two are distinct queries:
```sql
select * from user where name = 'x'
select * from user where name = 'z'
```

But their "normalized" form would be same:
```sql
select * from user where name = ?
```

This helps highlight queries ran in loop which might not register as
duplicate but are possibly "duplicate".
2023-07-19 16:45:30 +05:30
Ankush Menat
154a6dd9ed
perf: Reduce recorder overhead (#21656)
By processing `EXPLAIN` of queries in background after recording is
completed, the overhead reduces significantly and hence can be used
"more" in production environment too.
2023-07-12 19:34:23 +05:30
Ankush Menat
ec3f705e4f
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")
```
2022-12-09 14:18:49 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Suraj Shetty
2d8c6c1710 Merge branch 'develop' of https://github.com/frappe/frappe into refactor-website 2021-06-03 11:43:28 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Suraj Shetty
9b26307fe5 test: Use get_response_content to get content 2021-05-17 12:23:50 +05:30
Suraj Shetty
18497989dc refactor: Remove render_page from render.py
& replace all usages of render_page with get_response
2021-05-14 21:30:28 +05:30
Aditya Hase
6a059fc2ac
test(recorder): Error page rendering shouldn't fail when recorder is active 2020-10-28 09:36:19 +05:30
Gavin D'souza
e9a6927039 chore: fixed imports after module restructure 2019-11-29 21:08:30 +05:30
Rushabh Mehta
1c893e44c0 fix: frappe.conf.db_type -> frappe.db.db_type 2019-05-24 11:44:28 +05:30
Aditya Hase
127ff39d2a test(recorder): fallback to mariadb if sql dialect is not defined 2019-02-19 21:58:58 +05:30
Aditya Hase
8bb2288992 test(recorder): Fix tests for postgres 2019-02-19 21:58:58 +05:30
Aditya Hase
e33563e24c test(recorder): Add python tests for recorder 2019-02-19 21:58:58 +05:30