config.toml¶
Most Kolo configuration happens via the .kolo/config.toml
file, but there are also a number of environment variables
KOLO_PATH¶
You can customise the location of the .kolo
directory using the KOLO_PATH
environment variable. The .kolo
directory stores Kolo’s private data and the config.toml
configuration file.
KOLO_DISABLE¶
Set the KOLO_DISABLE
environment variable to 1
to disable the KoloMiddleware. Kolo automatically disables itself if the Django DEBUG
setting is set to False (as should be the case in production) or if it detects that another profiler is already active.
config.toml¶
Filters¶
By default Kolo traces all code in your project and ignores standard library or third party code. Filters let you customize this behavior.
Ignore Frames¶
ignore_frames
is a list of file path fragments:
# .kolo/config.toml
[filters]
ignore_frames = ["ignore_me.py", "/ignore_directory/"]
This will ignore any file called ignore_me.py
or any file with /ignore_directory/
in its path.
Include Frames¶
# .kolo/config.toml
[filters]
include_frames = ["json", "django/db"]
This will include any frames from the json
module of the standard library and from Django’s database code in django.db
.
Note
Including standard library and third party code can generate a lot of extra data, which may slow down execution. If you notice slow execution, try to make your includes more narrow.
Ignore Request Paths¶
By default Kolo generates a trace for every Django request. Sometimes you may want to exclude some urls. To do this, add entries to ignore_request_paths
:
# .kolo/config.toml
[filters]
ignore_request_paths = ["/static/", "favicon.ico"]
lightweight_repr¶
Some Python objects have __repr__
methods that are expensive to call. By default Kolo serializes unknown objects by calling repr
, so this can have a significant impact on Kolo’s overhead. If you think this is a problem in your project, you can set the lightweight_repr
config option to true
.
hide_startup_message¶
When the django development server starts up, Kolo prints out a message to let users know how to acccess the Kolo web app. This message can be disabled by setting the hide_startup_message
config option to true
.
pyproject.toml¶
Instead of using .kolo/config.toml
, you can instead put your config in pyproject.toml
in a [tool.kolo]
section:
# pyproject.toml
[tool.kolo]
lightweight_repr = true
[tool.kolo.filters]
ignore_request_paths = ["/static/", "favicon.ico"]