Django middleware that integrates Server-Timing header
Project description
django-server-timing
Django middleware that exposed collected metrics into HTTP Server Timing header.
This headers is used by browser to display several metrics into the Timing
tab of the Network
interface.
Right now, this header is not supported properlly by all browser
It doesn't effect unsupported browser.
This middleware will send the entire header value since not all browsers supports sending it via HTTP Trailer.
Install
It works on Python >= 3.10 and Django >= 4.2
Install easily via pip
or uv
pip install django-server-timing
# or with uv
uv add django-server-timing
# For SQL timing with django-silk integration
pip install django-server-timing[silk]
# or with uv
uv add django-server-timing[silk]
And configure MIDDLEWARES
MIDDLEWARE += ['server_timing.middleware.ServerTiming']
Usage
import time
from django.http import HttpResponse
from server_timing.middleware import TimedService, timed, timed_wrapper
@timed_wrapper('index', 'Index View')
def index(request):
home_service = TimedService('first', 'First service')
home_service.start()
time.sleep(0.3)
home_service.end()
with timed('second', 'Second service'):
time.sleep(0.5)
return HttpResponse('This page shows a list of most recent posts.')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_server_timing-0.2.0.tar.gz
.
File metadata
- Download URL: django_server_timing-0.2.0.tar.gz
- Upload date:
- Size: 141.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5ee804ce900b9ba5808d256ca861fe3d3dd52944f6c7caa41d55a08ec95eaa09
|
|
MD5 |
0c0d040d6835cdc46aede9f10ce95ea5
|
|
BLAKE2b-256 |
226ad8679530d3418132ce46faac254c00910a521239519f8c2720f55db39e85
|
Provenance
The following attestation bundles were made for django_server_timing-0.2.0.tar.gz
:
Publisher:
ci.yml
on vtemian/django-server-timing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
django_server_timing-0.2.0.tar.gz
-
Subject digest:
5ee804ce900b9ba5808d256ca861fe3d3dd52944f6c7caa41d55a08ec95eaa09
- Sigstore transparency entry: 259669062
- Sigstore integration time:
-
Permalink:
vtemian/django-server-timing@5e352a8d816f08126191604f2de112aaef071c89
-
Branch / Tag:
refs/tags/v0.2.0
- Owner: https://github.com/vtemian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
ci.yml@5e352a8d816f08126191604f2de112aaef071c89
-
Trigger Event:
push
-
Statement type:
File details
Details for the file django_server_timing-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: django_server_timing-0.2.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
fa0182bf175ad15f23daaa9c0caf7c4114e6089fb17ab5ba1c0001984654c14c
|
|
MD5 |
76306f99f69c27ad09c7d4c2d13da8d9
|
|
BLAKE2b-256 |
b2d331f5dab8d4d1486a00c7586d0d8eb327ae4a366e1e199d5f907c71773556
|
Provenance
The following attestation bundles were made for django_server_timing-0.2.0-py3-none-any.whl
:
Publisher:
ci.yml
on vtemian/django-server-timing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
django_server_timing-0.2.0-py3-none-any.whl
-
Subject digest:
fa0182bf175ad15f23daaa9c0caf7c4114e6089fb17ab5ba1c0001984654c14c
- Sigstore transparency entry: 259669071
- Sigstore integration time:
-
Permalink:
vtemian/django-server-timing@5e352a8d816f08126191604f2de112aaef071c89
-
Branch / Tag:
refs/tags/v0.2.0
- Owner: https://github.com/vtemian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
ci.yml@5e352a8d816f08126191604f2de112aaef071c89
-
Trigger Event:
push
-
Statement type: