mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-14 00:09:56 +00:00
[dev] django silk - advanced profiling (#11004)
* django silk - advanced profiling - Adds option for enabling advanced silk profiling * Enable binary file generation
This commit is contained in:
@@ -37,6 +37,10 @@ Once enabled, you can access the silk interface at the `/silk/` endpoint of your
|
|||||||
!!! tip "Run Migrations"
|
!!! tip "Run Migrations"
|
||||||
If you are enabling django-silk for the first time, you may need to run database migrations to create the necessary tables. You can do this by running `invoke migrate`.
|
If you are enabling django-silk for the first time, you may need to run database migrations to create the necessary tables. You can do this by running `invoke migrate`.
|
||||||
|
|
||||||
|
#### Detailed Profiling
|
||||||
|
|
||||||
|
To enable detailed profiling in django-silk, set the `INVENTREE_DEBUG_SILK_PROFILING` environment variable to `True`, or set the `debug_silk_profiling` option to `True` in your config file. This will enable more granular profiling features within django-silk. Refer to the [django-silk documentation](https://github.com/jazzband/django-silk#profiling) for more information.
|
||||||
|
|
||||||
### Django QueryCount
|
### Django QueryCount
|
||||||
|
|
||||||
Enabling the `INVENTREE_DEBUG_QUERYCOUNT` setting will log (to the terminal) the number of database queries executed for each page load. This can be useful for identifying performance bottlenecks in the InvenTree server. Note that this setting is only available if `INVENTREE_DEBUG` is also enabled.
|
Enabling the `INVENTREE_DEBUG_QUERYCOUNT` setting will log (to the terminal) the number of database queries executed for each page load. This can be useful for identifying performance bottlenecks in the InvenTree server. Note that this setting is only available if `INVENTREE_DEBUG` is also enabled.
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ The following debugging / logging options are available:
|
|||||||
| INVENTREE_DEBUG | debug | Enable [debug mode](./index.md#debug-mode) | False |
|
| INVENTREE_DEBUG | debug | Enable [debug mode](./index.md#debug-mode) | False |
|
||||||
| INVENTREE_DEBUG_QUERYCOUNT | debug_querycount | Enable support for [django-querycount](../develop/index.md#django-querycount) middleware. | False |
|
| INVENTREE_DEBUG_QUERYCOUNT | debug_querycount | Enable support for [django-querycount](../develop/index.md#django-querycount) middleware. | False |
|
||||||
| INVENTREE_DEBUG_SILK | debug_silk | Enable support for [django-silk](../develop/index.md#django-silk) profiling tool. | False |
|
| INVENTREE_DEBUG_SILK | debug_silk | Enable support for [django-silk](../develop/index.md#django-silk) profiling tool. | False |
|
||||||
|
| INVENTREE_DEBUG_SILK_PROFILING | debug_silk_profiling | Enable detailed profiling in django-silk | False |
|
||||||
| INVENTREE_DB_LOGGING | db_logging | Enable logging of database messages | False |
|
| INVENTREE_DB_LOGGING | db_logging | Enable logging of database messages | False |
|
||||||
| INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal | WARNING |
|
| INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal | WARNING |
|
||||||
| INVENTREE_JSON_LOG | json_log | log as json | False |
|
| INVENTREE_JSON_LOG | json_log | log as json | False |
|
||||||
|
|||||||
@@ -377,6 +377,11 @@ if DJANGO_SILK_ENABLED: # pragma: no cover
|
|||||||
MIDDLEWARE.append('silk.middleware.SilkyMiddleware')
|
MIDDLEWARE.append('silk.middleware.SilkyMiddleware')
|
||||||
INSTALLED_APPS.append('silk')
|
INSTALLED_APPS.append('silk')
|
||||||
|
|
||||||
|
# Optionally enable the silk python profiler
|
||||||
|
SILKY_PYTHON_PROFILER = SILKY_PYTHON_PROFILER_BINARY = get_boolean_setting(
|
||||||
|
'INVENTREE_DEBUG_SILK_PROFILING', 'debug_silk_profiling', False
|
||||||
|
)
|
||||||
|
|
||||||
# In DEBUG mode, add support for django-querycount
|
# In DEBUG mode, add support for django-querycount
|
||||||
# Ref: https://github.com/bradmontgomery/django-querycount
|
# Ref: https://github.com/bradmontgomery/django-querycount
|
||||||
if DEBUG and get_boolean_setting( # pragma: no cover
|
if DEBUG and get_boolean_setting( # pragma: no cover
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ debug: False
|
|||||||
|
|
||||||
# Additional debug options
|
# Additional debug options
|
||||||
debug_querycount: False
|
debug_querycount: False
|
||||||
|
debug_silk: False
|
||||||
|
debug_silk_profiling: False
|
||||||
debug_shell: False
|
debug_shell: False
|
||||||
|
|
||||||
# Set to False to disable the admin interface, or use the environment variable INVENTREE_ADMIN_ENABLED
|
# Set to False to disable the admin interface, or use the environment variable INVENTREE_ADMIN_ENABLED
|
||||||
|
|||||||
Reference in New Issue
Block a user