Backend: Error Monitoring
Go
Java
JS
Python
Ruby
Rust
Backend: Logging
Go
JS
Python
Ruby
Java
Rust
Hosting Providers
Backend: Tracing
Go
Node.js
Python
Rust
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Django Tracing
Learn how to set up highlight.io tracing for your Django app.
1
Setup your frontend Highlight snippet with tracingOrigins.
Make sure that you followed the fullstack mapping guide.
H.init("<YOUR_PROJECT_ID>", {
tracingOrigins: ['localhost', 'example.myapp.com/backend'],
networkRecording: {
enabled: true,
recordHeadersAndBody: true,
},
});
2
Install the highlight-io python package.
Download the package from pypi and save it to your requirements. If you use a zip or s3 file upload to publish your function, you will want to make sure highlight-io
is part of the build.
poetry add highlight-io[Django]
# or with pip
pip install highlight-io[Django]
3
Initialize the Highlight SDK.
Add Highlight with the Django integration to your settings.py
file.
import highlight_io
from highlight_io.integrations.django import DjangoIntegration
# `instrument_logging=True` sets up logging instrumentation.
# if you do not want to send logs or are using `loguru`, pass `instrument_logging=False`
H = highlight_io.H(
"<YOUR_PROJECT_ID>",
integrations=[DjangoIntegration()],
instrument_logging=True,
service_name="my-django-app",
service_version="git-sha",
environment="production",
)
4
Hit your Django app.
Visit one your Django views in your browser.
from django.http import HttpResponse, HttpRequest
def index(request: HttpRequest):
return HttpResponse("Hello world!")
5
Verify your backend traces are being recorded.
Visit the highlight traces portal and check that backend traces are coming in.