diff --git a/docs/docs/develop/index.md b/docs/docs/develop/index.md index cbdbbbd051..907d12099a 100644 --- a/docs/docs/develop/index.md +++ b/docs/docs/develop/index.md @@ -37,6 +37,10 @@ Once enabled, you can access the silk interface at the `/silk/` endpoint of your !!! 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`. +#### 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 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. diff --git a/docs/docs/start/config.md b/docs/docs/start/config.md index 8575be8e03..c739ad2a97 100644 --- a/docs/docs/start/config.md +++ b/docs/docs/start/config.md @@ -94,6 +94,7 @@ The following debugging / logging options are available: | 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_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_LOG_LEVEL | log_level | Set level of logging to terminal | WARNING | | INVENTREE_JSON_LOG | json_log | log as json | False | diff --git a/src/backend/InvenTree/InvenTree/settings.py b/src/backend/InvenTree/InvenTree/settings.py index 076cc53c96..7becfe63c5 100644 --- a/src/backend/InvenTree/InvenTree/settings.py +++ b/src/backend/InvenTree/InvenTree/settings.py @@ -377,6 +377,11 @@ if DJANGO_SILK_ENABLED: # pragma: no cover MIDDLEWARE.append('silk.middleware.SilkyMiddleware') 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 # Ref: https://github.com/bradmontgomery/django-querycount if DEBUG and get_boolean_setting( # pragma: no cover diff --git a/src/backend/InvenTree/config_template.yaml b/src/backend/InvenTree/config_template.yaml index 4fa23d3eb3..f08d86a84d 100644 --- a/src/backend/InvenTree/config_template.yaml +++ b/src/backend/InvenTree/config_template.yaml @@ -36,6 +36,8 @@ debug: False # Additional debug options debug_querycount: False +debug_silk: False +debug_silk_profiling: False debug_shell: False # Set to False to disable the admin interface, or use the environment variable INVENTREE_ADMIN_ENABLED