django-celery-logs 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_celery_logs-0.2.0/CHANGES.rst +76 -0
- django_celery_logs-0.2.0/LICENSE +21 -0
- django_celery_logs-0.2.0/MANIFEST.in +6 -0
- django_celery_logs-0.2.0/PKG-INFO +380 -0
- django_celery_logs-0.2.0/README.pt.rst +68 -0
- django_celery_logs-0.2.0/README.rst +244 -0
- django_celery_logs-0.2.0/django_celery_logs/__init__.py +1 -0
- django_celery_logs-0.2.0/django_celery_logs/admin.py +358 -0
- django_celery_logs-0.2.0/django_celery_logs/apps.py +12 -0
- django_celery_logs-0.2.0/django_celery_logs/migrations/0001_initial.py +65 -0
- django_celery_logs-0.2.0/django_celery_logs/migrations/__init__.py +1 -0
- django_celery_logs-0.2.0/django_celery_logs/models.py +62 -0
- django_celery_logs-0.2.0/django_celery_logs/signals.py +13 -0
- django_celery_logs-0.2.0/django_celery_logs/static/django_celery_logs/css/admin_filters.css +7 -0
- django_celery_logs-0.2.0/django_celery_logs/static/django_celery_logs/js/admin_filters.js +35 -0
- django_celery_logs-0.2.0/django_celery_logs/tasks.py +45 -0
- django_celery_logs-0.2.0/django_celery_logs/templates/admin/celery_log/tasklog/change_form.html +21 -0
- django_celery_logs-0.2.0/django_celery_logs/templates/admin/celery_log/tasklog/change_list.html +214 -0
- django_celery_logs-0.2.0/django_celery_logs/templates/admin/celery_log/tasklogstatistics/change_list.html +325 -0
- django_celery_logs-0.2.0/django_celery_logs/templatetags/__init__.py +1 -0
- django_celery_logs-0.2.0/django_celery_logs/templatetags/celery_logs_admin.py +20 -0
- django_celery_logs-0.2.0/django_celery_logs/utils.py +173 -0
- django_celery_logs-0.2.0/django_celery_logs/widgets.py +16 -0
- django_celery_logs-0.2.0/django_celery_logs.egg-info/PKG-INFO +380 -0
- django_celery_logs-0.2.0/django_celery_logs.egg-info/SOURCES.txt +44 -0
- django_celery_logs-0.2.0/django_celery_logs.egg-info/dependency_links.txt +1 -0
- django_celery_logs-0.2.0/django_celery_logs.egg-info/requires.txt +17 -0
- django_celery_logs-0.2.0/django_celery_logs.egg-info/top_level.txt +1 -0
- django_celery_logs-0.2.0/docs_src/Makefile +15 -0
- django_celery_logs-0.2.0/docs_src/make.bat +36 -0
- django_celery_logs-0.2.0/docs_src/source/admin.rst +53 -0
- django_celery_logs-0.2.0/docs_src/source/api/index.rst +38 -0
- django_celery_logs-0.2.0/docs_src/source/changelog.rst +4 -0
- django_celery_logs-0.2.0/docs_src/source/conf.py +70 -0
- django_celery_logs-0.2.0/docs_src/source/development/documentation.rst +36 -0
- django_celery_logs-0.2.0/docs_src/source/development/installation.rst +49 -0
- django_celery_logs-0.2.0/docs_src/source/development/release.rst +14 -0
- django_celery_logs-0.2.0/docs_src/source/features.rst +13 -0
- django_celery_logs-0.2.0/docs_src/source/index.rst +49 -0
- django_celery_logs-0.2.0/docs_src/source/quickstart/installation.rst +39 -0
- django_celery_logs-0.2.0/docs_src/source/settings.rst +61 -0
- django_celery_logs-0.2.0/docs_src/source/usage.rst +69 -0
- django_celery_logs-0.2.0/pyproject.toml +34 -0
- django_celery_logs-0.2.0/setup.cfg +4 -0
- django_celery_logs-0.2.0/setup.py +97 -0
- django_celery_logs-0.2.0/tests/test_models_and_utils.py +70 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Changelog
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
All notable changes to this project will be documented in this file.
|
|
5
|
+
|
|
6
|
+
The project follows semantic versioning while the public API stabilizes.
|
|
7
|
+
|
|
8
|
+
0.2.0
|
|
9
|
+
-----
|
|
10
|
+
|
|
11
|
+
Released on 2026-09-19.
|
|
12
|
+
|
|
13
|
+
Added
|
|
14
|
+
~~~~~
|
|
15
|
+
|
|
16
|
+
* Added PyPI-ready package metadata, project URLs, classifiers, and package
|
|
17
|
+
data configuration.
|
|
18
|
+
* Added ``uv``-based development workflow with Makefile targets for
|
|
19
|
+
dependencies, tests, Django checks, documentation, builds, and releases.
|
|
20
|
+
* Added Sphinx documentation source with installation, settings, admin, usage,
|
|
21
|
+
development, release, changelog, and API pages.
|
|
22
|
+
* Added documentation dependencies for local docs development:
|
|
23
|
+
``sphinx-autobuild``, ``sphinx-intl``, and
|
|
24
|
+
``sphinxjp.themes.basicstrap``.
|
|
25
|
+
* Added badges for PyPI, supported Python versions, license, GitHub Actions,
|
|
26
|
+
coverage, documentation, and open-source status.
|
|
27
|
+
* Added English and Portuguese README files.
|
|
28
|
+
|
|
29
|
+
Changed
|
|
30
|
+
~~~~~~~
|
|
31
|
+
|
|
32
|
+
* Improved README guidance for installing with both ``pip`` and ``uv``.
|
|
33
|
+
* Clarified required Celery settings:
|
|
34
|
+
``CELERY_TASK_IGNORE_RESULT = True`` and
|
|
35
|
+
``CELERY_RESULT_SERIALIZER = "json"``.
|
|
36
|
+
* Clarified that other Celery result apps, such as
|
|
37
|
+
``django_celery_results``, should not be enabled together with this app.
|
|
38
|
+
* Clarified that ``CELERY_RESULT_BACKEND`` and ``CELERY_CACHE_BACKEND`` should
|
|
39
|
+
be removed unless another part of the project explicitly requires them.
|
|
40
|
+
* Removed duplicated ``INSTALLED_APPS`` examples from the README and settings
|
|
41
|
+
documentation.
|
|
42
|
+
* Documented that Django automatically loads
|
|
43
|
+
``django_celery_logs.apps.CeleryLogsConfig`` when ``django_celery_logs`` is
|
|
44
|
+
added to ``INSTALLED_APPS``.
|
|
45
|
+
|
|
46
|
+
Packaging
|
|
47
|
+
~~~~~~~~~
|
|
48
|
+
|
|
49
|
+
* Removed legacy requirements-file workflow in favor of ``pyproject.toml`` and
|
|
50
|
+
``uv.lock``.
|
|
51
|
+
* Kept runtime dependencies in package metadata so installs from PyPI include
|
|
52
|
+
Django, Celery, and boltons automatically.
|
|
53
|
+
|
|
54
|
+
0.1.0
|
|
55
|
+
-----
|
|
56
|
+
|
|
57
|
+
Released on 2026-09-19.
|
|
58
|
+
|
|
59
|
+
Added
|
|
60
|
+
~~~~~
|
|
61
|
+
|
|
62
|
+
* Added reusable Django app for storing Celery task execution logs.
|
|
63
|
+
* Added Celery signal handlers for successful and failed task executions.
|
|
64
|
+
* Added ``TaskLog`` model with task id, task name, queue, worker, args, kwargs,
|
|
65
|
+
result, error message, traceback, timestamp, duration, periodic task flag,
|
|
66
|
+
and traceback context data.
|
|
67
|
+
* Added ``TaskConfig`` model for configuring task rerun behavior from Django
|
|
68
|
+
admin.
|
|
69
|
+
* Added Django admin task log list with filters, search, pagination controls,
|
|
70
|
+
auto-refresh, and task rerun action.
|
|
71
|
+
* Added task detail page with formatted JSON and traceback context.
|
|
72
|
+
* Added statistics admin page with charts for throughput, failures, queues,
|
|
73
|
+
workers, periodic tasks, slow tasks, and common errors.
|
|
74
|
+
* Added ``clear_celery_task_logs`` cleanup task.
|
|
75
|
+
* Added ``acquire_lock_or_fail`` helper for cache-backed task de-duplication.
|
|
76
|
+
* Added test project and initial pytest coverage.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rafael Henter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-celery-logs
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Reusable Django app to store and inspect Celery task logs in Django admin.
|
|
5
|
+
Home-page: https://github.com/rhenter/django-celery-logs
|
|
6
|
+
Author: Rafael Henter
|
|
7
|
+
Author-email: rafael@henter.com.br
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Source, https://github.com/rhenter/django-celery-logs
|
|
10
|
+
Project-URL: Issues, https://github.com/rhenter/django-celery-logs/issues
|
|
11
|
+
Keywords: django celery logs admin task monitoring
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Framework :: Django :: 4.2
|
|
15
|
+
Classifier: Framework :: Django :: 5.0
|
|
16
|
+
Classifier: Framework :: Django :: 5.1
|
|
17
|
+
Classifier: Framework :: Django :: 5.2
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/x-rst
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: boltons>=24.0
|
|
30
|
+
Requires-Dist: celery>=5.3
|
|
31
|
+
Requires-Dist: django>=4.2
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: build; extra == "dev"
|
|
34
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-django; extra == "dev"
|
|
38
|
+
Requires-Dist: setuptools>=64; extra == "dev"
|
|
39
|
+
Requires-Dist: sphinx; extra == "dev"
|
|
40
|
+
Requires-Dist: sphinx-autobuild; extra == "dev"
|
|
41
|
+
Requires-Dist: sphinx-intl; extra == "dev"
|
|
42
|
+
Requires-Dist: sphinxjp.themes.basicstrap; extra == "dev"
|
|
43
|
+
Requires-Dist: twine; extra == "dev"
|
|
44
|
+
Requires-Dist: wheel; extra == "dev"
|
|
45
|
+
Dynamic: author
|
|
46
|
+
Dynamic: author-email
|
|
47
|
+
Dynamic: classifier
|
|
48
|
+
Dynamic: description
|
|
49
|
+
Dynamic: description-content-type
|
|
50
|
+
Dynamic: home-page
|
|
51
|
+
Dynamic: keywords
|
|
52
|
+
Dynamic: license
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
Dynamic: project-url
|
|
55
|
+
Dynamic: requires-dist
|
|
56
|
+
Dynamic: requires-python
|
|
57
|
+
Dynamic: summary
|
|
58
|
+
|
|
59
|
+
Django Celery Logs
|
|
60
|
+
==================
|
|
61
|
+
|
|
62
|
+
|PyPI latest| |PyPI Version| |PyPI License| |GitHub Actions Status| |Coverage| |Docs| |Open Source? Yes!|
|
|
63
|
+
|
|
64
|
+
Django Celery Logs is a reusable Django app that records Celery task successes
|
|
65
|
+
and failures, stores structured results and traceback data, and exposes the
|
|
66
|
+
records in Django admin.
|
|
67
|
+
|
|
68
|
+
It is designed for projects that want task observability without keeping
|
|
69
|
+
Celery's default result backend enabled. By running Celery with
|
|
70
|
+
``CELERY_TASK_IGNORE_RESULT = True``, successful task payloads do not need to be
|
|
71
|
+
stored by a result backend, which can reduce memory/storage pressure and speed
|
|
72
|
+
up task processing. Django Celery Logs keeps the operational history you need in
|
|
73
|
+
your Django database instead: task metadata, structured JSON results, failures,
|
|
74
|
+
durations, queues, workers, and admin statistics.
|
|
75
|
+
|
|
76
|
+
Requirements
|
|
77
|
+
------------
|
|
78
|
+
|
|
79
|
+
* Python 3.10 or later
|
|
80
|
+
* Django 4.2 or later
|
|
81
|
+
* Celery 5.3 or later
|
|
82
|
+
|
|
83
|
+
Features
|
|
84
|
+
--------
|
|
85
|
+
|
|
86
|
+
* Logs successful and failed Celery task executions through Celery signals.
|
|
87
|
+
* Stores task id, name, queue, worker, args, kwargs, result, error message,
|
|
88
|
+
traceback, timestamp, and duration in seconds.
|
|
89
|
+
* Captures rich failure tracebacks with frame-by-frame context and local
|
|
90
|
+
variables to make debugging failed tasks faster.
|
|
91
|
+
* Adds Django admin pages for log inspection and task re-run.
|
|
92
|
+
* Adds an admin statistics module with charts and metrics for throughput,
|
|
93
|
+
failures, queues, workers, periodic tasks, slow tasks, and common errors.
|
|
94
|
+
* Adds auto-refresh and configurable pagination controls to the admin task log
|
|
95
|
+
list for near real-time monitoring.
|
|
96
|
+
* Includes a cleanup task named ``clear_celery_task_logs``.
|
|
97
|
+
* Includes ``acquire_lock_or_fail`` for cache-backed task de-duplication.
|
|
98
|
+
|
|
99
|
+
Installation
|
|
100
|
+
------------
|
|
101
|
+
|
|
102
|
+
Install from PyPI:
|
|
103
|
+
|
|
104
|
+
.. code-block:: bash
|
|
105
|
+
|
|
106
|
+
pip install django-celery-logs
|
|
107
|
+
|
|
108
|
+
If you use ``uv``:
|
|
109
|
+
|
|
110
|
+
.. code-block:: bash
|
|
111
|
+
|
|
112
|
+
uv pip install django-celery-logs
|
|
113
|
+
|
|
114
|
+
Install from source:
|
|
115
|
+
|
|
116
|
+
.. code-block:: bash
|
|
117
|
+
|
|
118
|
+
git clone git@github.com:rhenter/django-celery-logs.git
|
|
119
|
+
cd django-celery-logs
|
|
120
|
+
pip install .
|
|
121
|
+
|
|
122
|
+
If you use ``uv``:
|
|
123
|
+
|
|
124
|
+
.. code-block:: bash
|
|
125
|
+
|
|
126
|
+
uv pip install .
|
|
127
|
+
|
|
128
|
+
Settings
|
|
129
|
+
--------
|
|
130
|
+
|
|
131
|
+
Celery result settings
|
|
132
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
|
133
|
+
|
|
134
|
+
Django Celery Logs is intended to replace Celery result-backend storage for task
|
|
135
|
+
inspection. Configure Celery to ignore the default result backend and serialize
|
|
136
|
+
task data as JSON:
|
|
137
|
+
|
|
138
|
+
.. code-block:: python
|
|
139
|
+
|
|
140
|
+
CELERY_TASK_IGNORE_RESULT = True
|
|
141
|
+
CELERY_RESULT_SERIALIZER = "json"
|
|
142
|
+
|
|
143
|
+
Do not enable other Celery result apps in ``INSTALLED_APPS`` for the same
|
|
144
|
+
purpose. For example, remove ``django_celery_results`` if it is installed.
|
|
145
|
+
Only ``django_celery_logs`` should be added, as shown in the Django app section
|
|
146
|
+
below.
|
|
147
|
+
|
|
148
|
+
If these settings exist, remove them unless another part of your project really
|
|
149
|
+
depends on them:
|
|
150
|
+
|
|
151
|
+
.. code-block:: python
|
|
152
|
+
|
|
153
|
+
CELERY_RESULT_BACKEND = "..."
|
|
154
|
+
CELERY_CACHE_BACKEND = "..."
|
|
155
|
+
|
|
156
|
+
Django app
|
|
157
|
+
~~~~~~~~~~
|
|
158
|
+
|
|
159
|
+
Add the app to ``INSTALLED_APPS``:
|
|
160
|
+
|
|
161
|
+
.. code-block:: python
|
|
162
|
+
|
|
163
|
+
INSTALLED_APPS = [
|
|
164
|
+
...
|
|
165
|
+
"django_celery_logs",
|
|
166
|
+
...
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
Run migrations:
|
|
170
|
+
|
|
171
|
+
.. code-block:: bash
|
|
172
|
+
|
|
173
|
+
python manage.py migrate
|
|
174
|
+
|
|
175
|
+
Optionally configure how many days logs are retained by the cleanup task:
|
|
176
|
+
|
|
177
|
+
.. code-block:: python
|
|
178
|
+
|
|
179
|
+
CELERY_TASK_LOGS_EXPIRES = 7
|
|
180
|
+
|
|
181
|
+
Admin
|
|
182
|
+
-----
|
|
183
|
+
|
|
184
|
+
The package includes Django admin templates and static assets for:
|
|
185
|
+
|
|
186
|
+
* Task log list with auto-refresh, collapsible filters, configurable page size,
|
|
187
|
+
JSON result preview, and a shortcut to statistics.
|
|
188
|
+
* Task log detail with a re-run action.
|
|
189
|
+
* Task statistics with cards, charts, top tasks, slowest tasks, queue/worker
|
|
190
|
+
distribution, periodic task distribution, and top error messages.
|
|
191
|
+
|
|
192
|
+
Failure tracebacks are stored as structured JSON and rendered interactively in
|
|
193
|
+
the admin, including exception type, message, stack frames, and sanitized local
|
|
194
|
+
variables from the frame context.
|
|
195
|
+
|
|
196
|
+
Auto-refresh
|
|
197
|
+
~~~~~~~~~~~~
|
|
198
|
+
|
|
199
|
+
The task log list includes an auto-refresh control for operational monitoring.
|
|
200
|
+
You can keep the admin open while workers are processing tasks and refresh the
|
|
201
|
+
list every 5, 10, 30, or 60 seconds. The selected interval is saved in the
|
|
202
|
+
browser, so the page keeps the same refresh behavior after reloads.
|
|
203
|
+
|
|
204
|
+
Usage
|
|
205
|
+
-----
|
|
206
|
+
|
|
207
|
+
Once Django loads the app, Celery's ``task_success`` and ``task_failure``
|
|
208
|
+
signals create ``TaskLog`` records automatically.
|
|
209
|
+
|
|
210
|
+
To remove old logs, schedule the bundled task in Celery beat or call it
|
|
211
|
+
directly:
|
|
212
|
+
|
|
213
|
+
.. code-block:: python
|
|
214
|
+
|
|
215
|
+
from django_celery_logs.tasks import clear_celery_task_logs
|
|
216
|
+
|
|
217
|
+
clear_celery_task_logs.delay()
|
|
218
|
+
|
|
219
|
+
To avoid logging an intentionally skipped successful task, return a dictionary
|
|
220
|
+
with ``ignore_task_log``:
|
|
221
|
+
|
|
222
|
+
.. code-block:: python
|
|
223
|
+
|
|
224
|
+
return {"status": "skipped", "ignore_task_log": True}
|
|
225
|
+
|
|
226
|
+
Contributing
|
|
227
|
+
------------
|
|
228
|
+
|
|
229
|
+
Pull requests are welcome.
|
|
230
|
+
|
|
231
|
+
Development
|
|
232
|
+
-----------
|
|
233
|
+
|
|
234
|
+
This project uses ``uv`` for local development commands. Install development
|
|
235
|
+
dependencies with:
|
|
236
|
+
|
|
237
|
+
.. code-block:: bash
|
|
238
|
+
|
|
239
|
+
make deps
|
|
240
|
+
|
|
241
|
+
Run the test suite:
|
|
242
|
+
|
|
243
|
+
.. code-block:: bash
|
|
244
|
+
|
|
245
|
+
make test
|
|
246
|
+
|
|
247
|
+
Run Django's system checks against the bundled test project:
|
|
248
|
+
|
|
249
|
+
.. code-block:: bash
|
|
250
|
+
|
|
251
|
+
make check
|
|
252
|
+
|
|
253
|
+
Build the source distribution and wheel:
|
|
254
|
+
|
|
255
|
+
.. code-block:: bash
|
|
256
|
+
|
|
257
|
+
make build
|
|
258
|
+
|
|
259
|
+
Useful Makefile targets:
|
|
260
|
+
|
|
261
|
+
* ``make deps`` installs the project and development dependencies with
|
|
262
|
+
``uv sync --extra dev``.
|
|
263
|
+
* ``make test`` runs ``uv run --extra dev pytest``.
|
|
264
|
+
* ``make check`` runs ``django check`` with the test project settings.
|
|
265
|
+
* ``make lint`` runs pre-commit hooks.
|
|
266
|
+
* ``make docs`` builds the Sphinx documentation.
|
|
267
|
+
* ``make clean`` removes build, cache, coverage, and bytecode files.
|
|
268
|
+
* ``make build`` creates ``sdist`` and ``wheel`` with ``uv build``.
|
|
269
|
+
* ``make release`` tags the current version and uploads ``dist/*`` with twine.
|
|
270
|
+
|
|
271
|
+
License
|
|
272
|
+
-------
|
|
273
|
+
|
|
274
|
+
MIT
|
|
275
|
+
|
|
276
|
+
.. |PyPI latest| image:: https://img.shields.io/pypi/pyversions/django-celery-logs.svg
|
|
277
|
+
:target: https://pypi.org/project/django-celery-logs/
|
|
278
|
+
:alt: Supported Python versions
|
|
279
|
+
|
|
280
|
+
.. |PyPI Version| image:: https://img.shields.io/pypi/v/django-celery-logs.svg
|
|
281
|
+
:target: https://pypi.org/project/django-celery-logs/
|
|
282
|
+
:alt: PyPI version
|
|
283
|
+
|
|
284
|
+
.. |PyPI License| image:: https://img.shields.io/pypi/l/django-celery-logs.svg
|
|
285
|
+
:target: https://pypi.org/project/django-celery-logs/
|
|
286
|
+
:alt: License
|
|
287
|
+
|
|
288
|
+
.. |GitHub Actions Status| image:: https://github.com/rhenter/django-celery-logs/actions/workflows/tests.yml/badge.svg
|
|
289
|
+
:target: https://github.com/rhenter/django-celery-logs/actions
|
|
290
|
+
:alt: GitHub Actions status
|
|
291
|
+
|
|
292
|
+
.. |Coverage| image:: https://codecov.io/gh/rhenter/django-celery-logs/branch/main/graph/badge.svg
|
|
293
|
+
:target: https://codecov.io/gh/rhenter/django-celery-logs
|
|
294
|
+
:alt: Coverage
|
|
295
|
+
|
|
296
|
+
.. |Docs| image:: https://readthedocs.org/projects/django-celery-logs/badge/?version=latest
|
|
297
|
+
:target: https://django-celery-logs.readthedocs.io/en/latest/
|
|
298
|
+
:alt: Documentation status
|
|
299
|
+
|
|
300
|
+
.. |Open Source? Yes!| image:: https://badgen.net/badge/Open%20Source%3F/Yes%21/blue
|
|
301
|
+
:target: https://github.com/rhenter/django-celery-logs
|
|
302
|
+
:alt: Open Source? Yes!
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
Changelog
|
|
306
|
+
=========
|
|
307
|
+
|
|
308
|
+
All notable changes to this project will be documented in this file.
|
|
309
|
+
|
|
310
|
+
The project follows semantic versioning while the public API stabilizes.
|
|
311
|
+
|
|
312
|
+
0.2.0
|
|
313
|
+
-----
|
|
314
|
+
|
|
315
|
+
Released on 2026-09-19.
|
|
316
|
+
|
|
317
|
+
Added
|
|
318
|
+
~~~~~
|
|
319
|
+
|
|
320
|
+
* Added PyPI-ready package metadata, project URLs, classifiers, and package
|
|
321
|
+
data configuration.
|
|
322
|
+
* Added ``uv``-based development workflow with Makefile targets for
|
|
323
|
+
dependencies, tests, Django checks, documentation, builds, and releases.
|
|
324
|
+
* Added Sphinx documentation source with installation, settings, admin, usage,
|
|
325
|
+
development, release, changelog, and API pages.
|
|
326
|
+
* Added documentation dependencies for local docs development:
|
|
327
|
+
``sphinx-autobuild``, ``sphinx-intl``, and
|
|
328
|
+
``sphinxjp.themes.basicstrap``.
|
|
329
|
+
* Added badges for PyPI, supported Python versions, license, GitHub Actions,
|
|
330
|
+
coverage, documentation, and open-source status.
|
|
331
|
+
* Added English and Portuguese README files.
|
|
332
|
+
|
|
333
|
+
Changed
|
|
334
|
+
~~~~~~~
|
|
335
|
+
|
|
336
|
+
* Improved README guidance for installing with both ``pip`` and ``uv``.
|
|
337
|
+
* Clarified required Celery settings:
|
|
338
|
+
``CELERY_TASK_IGNORE_RESULT = True`` and
|
|
339
|
+
``CELERY_RESULT_SERIALIZER = "json"``.
|
|
340
|
+
* Clarified that other Celery result apps, such as
|
|
341
|
+
``django_celery_results``, should not be enabled together with this app.
|
|
342
|
+
* Clarified that ``CELERY_RESULT_BACKEND`` and ``CELERY_CACHE_BACKEND`` should
|
|
343
|
+
be removed unless another part of the project explicitly requires them.
|
|
344
|
+
* Removed duplicated ``INSTALLED_APPS`` examples from the README and settings
|
|
345
|
+
documentation.
|
|
346
|
+
* Documented that Django automatically loads
|
|
347
|
+
``django_celery_logs.apps.CeleryLogsConfig`` when ``django_celery_logs`` is
|
|
348
|
+
added to ``INSTALLED_APPS``.
|
|
349
|
+
|
|
350
|
+
Packaging
|
|
351
|
+
~~~~~~~~~
|
|
352
|
+
|
|
353
|
+
* Removed legacy requirements-file workflow in favor of ``pyproject.toml`` and
|
|
354
|
+
``uv.lock``.
|
|
355
|
+
* Kept runtime dependencies in package metadata so installs from PyPI include
|
|
356
|
+
Django, Celery, and boltons automatically.
|
|
357
|
+
|
|
358
|
+
0.1.0
|
|
359
|
+
-----
|
|
360
|
+
|
|
361
|
+
Released on 2026-09-19.
|
|
362
|
+
|
|
363
|
+
Added
|
|
364
|
+
~~~~~
|
|
365
|
+
|
|
366
|
+
* Added reusable Django app for storing Celery task execution logs.
|
|
367
|
+
* Added Celery signal handlers for successful and failed task executions.
|
|
368
|
+
* Added ``TaskLog`` model with task id, task name, queue, worker, args, kwargs,
|
|
369
|
+
result, error message, traceback, timestamp, duration, periodic task flag,
|
|
370
|
+
and traceback context data.
|
|
371
|
+
* Added ``TaskConfig`` model for configuring task rerun behavior from Django
|
|
372
|
+
admin.
|
|
373
|
+
* Added Django admin task log list with filters, search, pagination controls,
|
|
374
|
+
auto-refresh, and task rerun action.
|
|
375
|
+
* Added task detail page with formatted JSON and traceback context.
|
|
376
|
+
* Added statistics admin page with charts for throughput, failures, queues,
|
|
377
|
+
workers, periodic tasks, slow tasks, and common errors.
|
|
378
|
+
* Added ``clear_celery_task_logs`` cleanup task.
|
|
379
|
+
* Added ``acquire_lock_or_fail`` helper for cache-backed task de-duplication.
|
|
380
|
+
* Added test project and initial pytest coverage.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Django Celery Logs
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
Django Celery Logs e uma app Django reutilizavel para registrar execucoes do
|
|
5
|
+
Celery, guardar resultados e tracebacks estruturados, e consultar tudo pelo
|
|
6
|
+
Django admin.
|
|
7
|
+
|
|
8
|
+
A biblioteca foi pensada para observar tarefas sem manter o result backend
|
|
9
|
+
padrao do Celery. Use ``CELERY_TASK_IGNORE_RESULT = True`` para reduzir uso de
|
|
10
|
+
memoria/storage e manter o historico operacional no banco da aplicacao.
|
|
11
|
+
|
|
12
|
+
Funcionalidades
|
|
13
|
+
---------------
|
|
14
|
+
|
|
15
|
+
* Registro automatico de sucessos e falhas via signals do Celery.
|
|
16
|
+
* Stacktrace estruturado das falhas, com frames e variaveis locais sanitizadas.
|
|
17
|
+
* Admin com listagem de logs, preview JSON, re-execucao de tasks e paginacao configuravel.
|
|
18
|
+
* Auto refresh na listagem com intervalos de 5, 10, 30 e 60 segundos.
|
|
19
|
+
* Modulo de estatisticas com cards, graficos, top tasks, tasks lentas, filas, workers e erros comuns.
|
|
20
|
+
|
|
21
|
+
Instalacao
|
|
22
|
+
----------
|
|
23
|
+
|
|
24
|
+
.. code-block:: bash
|
|
25
|
+
|
|
26
|
+
pip install django-celery-logs
|
|
27
|
+
|
|
28
|
+
Se voce usa ``uv``:
|
|
29
|
+
|
|
30
|
+
.. code-block:: bash
|
|
31
|
+
|
|
32
|
+
uv pip install django-celery-logs
|
|
33
|
+
|
|
34
|
+
Configuracao
|
|
35
|
+
------------
|
|
36
|
+
|
|
37
|
+
Configure o Celery para ignorar o backend padrao de resultados:
|
|
38
|
+
|
|
39
|
+
.. code-block:: python
|
|
40
|
+
|
|
41
|
+
CELERY_TASK_IGNORE_RESULT = True
|
|
42
|
+
CELERY_RESULT_SERIALIZER = "json"
|
|
43
|
+
|
|
44
|
+
Nao use apps concorrentes de resultado do Celery, como ``django_celery_results``,
|
|
45
|
+
junto com esta biblioteca. Se existirem e nao forem exigidas por outra parte do
|
|
46
|
+
projeto, remova tambem:
|
|
47
|
+
|
|
48
|
+
.. code-block:: python
|
|
49
|
+
|
|
50
|
+
CELERY_RESULT_BACKEND = "..."
|
|
51
|
+
CELERY_CACHE_BACKEND = "..."
|
|
52
|
+
|
|
53
|
+
.. code-block:: python
|
|
54
|
+
|
|
55
|
+
INSTALLED_APPS = [
|
|
56
|
+
...
|
|
57
|
+
"django_celery_logs",
|
|
58
|
+
...
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
Depois execute:
|
|
62
|
+
|
|
63
|
+
.. code-block:: bash
|
|
64
|
+
|
|
65
|
+
python manage.py migrate
|
|
66
|
+
|
|
67
|
+
A configuracao opcional ``CELERY_TASK_LOGS_EXPIRES`` define por quantos dias os
|
|
68
|
+
logs serao mantidos pela task de limpeza.
|