Tracepanel

Integrations

What the Python SDK records in each web framework and in each library it finds installed, and how to turn an integration off.

The Python SDK hooks into your web framework to record each request. It also traces the libraries your app uses, such as task queues, database drivers, HTTP clients, Redis and MongoDB. You don't configure a library integration. It turns on when your app first imports the library, if its setting is on. Tracepanel never loads a library your app doesn't import, so it adds little to startup.

Web frameworks

Each framework module turns Tracepanel on only in development. Django follows DEBUG. FastAPI, Starlette and Flask follow the app's debug mode. Falcon has no debug mode, so you turn it on yourself. tracepanel run turns Tracepanel on for any of them. See Installation for the setup of each.

In every framework, Tracepanel records the request's method, route, status, duration and errors, and what the request carried: its headers, query, cookies, the body as far as the app read it, and the response's headers and body. See Request. A request asked to be profiled also records where its time went in code. See Profile. tracepanel.profile() profiles the rest of a trace from your code. See profile(). A profiled trace says why in its root span's profile.reason: setting, header, cookie for the panel's button, parent when a profiled trace queued the task or made the call, or code.

The profiler takes the stack every profile_interval_ms. Code that keeps the CPU busy holds Python's GIL, so its stack can be taken less often than that. While a trace is profiled, Tracepanel lowers the interpreter's switch interval to profile_interval_ms, so the profiler gets the GIL back sooner, and a stack it takes late counts for the time since the last one. The work an async task hands to a thread, such as the ORM call it awaits through sync_to_async, is sampled under the coroutine that awaits it, so the task's own code shows. A memory profile uses Python's tracemalloc. It lists the 50 sites that held the most memory at the trace's peak.

A response's body is kept when the app sends it whole: JSON and forms with their secrets masked, and text. A page, a script, a stylesheet, binary content and a compressed body are kept by their size only, and a stream isn't read at all. Both bodies are kept up to max_body_kb, 64 KiB by default, and marked as cut past it. capture_body = false turns them off.

Each template render keeps the context it got: up to 40 names, each value as repr() shows it, masked under a secret's name. Showing a value never runs a query, so a QuerySet that hasn't run shows its model only. capture_template_context = false turns it off.

When the app connects to the agent, it sends its settings and versions for the app's page in the console and the panel's App tab. Django sends its UPPERCASE settings, and Flask its app.config, with the values under a secret's name and the credentials in a URL masked. The versions are Python's, the framework's and those of the drivers, task queues, servers and other packages that matter. FastAPI, Starlette and Falcon send the versions only. capture_settings = false leaves the settings out.

The server's access log leaves out the requests under prefix, so the panel's polling doesn't flood the terminal. This covers uvicorn, gunicorn, hypercorn, granian, daphne, and the Django and Flask development servers. quiet_access_log = false keeps them.

Tracepanel adds the panel to HTML pages and serves the console at /__tracepanel__/. A streamed page, such as Django's StreamingHttpResponse or Starlette's StreamingResponse, gets the panel too: the script goes in right after <head> opens, as the pieces pass. A compressed page, or one that declares its size, is left as it is. A redirect that answers a page's navigation, such as a form's POST, sets a short-lived cookie, so the panel on the next page lists the POST first.

Django

Tracepanel supports Django 5.2, 6.0 and 6.1. Django 6.x needs Python 3.12 or newer, and Python 3.15 works with Django 6.1 only.

Add tracepanel.django to INSTALLED_APPS. Tracepanel puts its middleware first, so it measures the whole request. It records these parts of Django with no further setup:

  • SQL on every database connection, including the async ORM, with the number of rows each query returned. Tracepanel keeps the place in your code across sync_to_async(), so it finds N+1 queries in async views too.
  • Each atomic() block as a transaction or a savepoint, and each on_commit() callback.
  • The view, named after its function or class, and each template render, with Django's engine or its Jinja2 backend.
  • Cache calls on every backend you create through caches.
  • Signals that have receivers, named by the signal, such as post_save, with the sender, the line that sent it and a span for each receiver.
  • Each call a file storage makes to its backend, and the phases of collectstatic.
  • Each migration that migrate applies or unapplies, with its operations, and the operations that lock or rewrite a table.
  • Each email sent with EmailMessage.send(), send_mail() or EmailMultiAlternatives, with its text and HTML.
  • Management commands as traces of their own. The ignore_commands setting leaves out the dev server, shells, the test runner and task workers by default.
  • The logged-in user, if the view loaded one, and logouts. The session the view used, with secrets masked.

The Django guide shows what each part gives you and the issues found in it.

FastAPI and Starlette

from fastapi import FastAPI

import tracepanel.fastapi

app = FastAPI(debug=True)
tracepanel.fastapi.install(app)

For Starlette, call tracepanel.asgi.install(app) on a Starlette(debug=True) app. tracepanel run uvicorn app.main:app needs no code for either.

Tracepanel names each request after its route template, such as GET /items/{item_id}, and runs the endpoint in a view span. Each render of Jinja2Templates is a template span. Tracepanel records the session and the user that Starlette's SessionMiddleware and AuthenticationMiddleware put on the request.

Flask

from flask import Flask

import tracepanel.flask

app = Flask(__name__)
tracepanel.flask.install(app)

Tracepanel is on when the app runs in debug mode, as with flask run --debug or app.run(debug=True). It names each request after its URL rule and runs the view in a view span. Each Jinja render is a template span. Tracepanel also records the errors Flask turns into a 500, the session as the view left it and the user Flask-Login loaded, and adds the trace's headers to Werkzeug's debugger page. It reads settings from app.config["TRACEPANEL"].

Falcon

import falcon

import tracepanel.falcon

app = falcon.App()
tracepanel.falcon.install(app, enabled=True)

Falcon has no debug mode, so pass enabled=True or set TRACEPANEL_ENABLED=1. Tracepanel names each request after the route's URI template, such as GET /posts/{post_id}. It runs the responder in a view span named after it, such as app.resources.PostResource.on_get, and records the errors Falcon turns into a 500. A responder that runs a Strawberry operation names the request after it, such as GraphQL query PostList.

Falcon's ASGI app, falcon.asgi.App, works the same, with tracepanel.falcon.install(app) or tracepanel run uvicorn app:app.

Any ASGI or WSGI app

tracepanel.asgi.install() and tracepanel.wsgi.install() work with any app, such as Litestar, Quart, Bottle, Pyramid or a plain callable. They wrap the app and return the wrapper, so serve what they return:

import tracepanel.asgi


async def app(scope, receive, send): ...


app = tracepanel.asgi.install(app)
import tracepanel.wsgi


def app(environ, start_response): ...


app = tracepanel.wsgi.install(app)

Tracepanel is on when the app has debug = True or when TRACEPANEL_ENABLED=1 is set. It names each request after its path, because it doesn't know the framework's routes. You pass settings as keyword arguments, with the same names as in Configuration.

Libraries in each framework

Django gets every library integration below. FastAPI, Starlette, Flask, Falcon, plain ASGI or WSGI apps, and scripts and workers under tracepanel run get those that don't need Django: logging, Jinja, SQLAlchemy, the database drivers, the HTTP clients, AWS, OpenAI, Anthropic, Redis, MongoDB, Celery, Dramatiq, RQ, Huey, Taskiq, FastStream, Strawberry and OpenTelemetry. All the frameworks record htmx requests.

Libraries

Tracepanel traces these libraries once your app imports them:

LibrarySettingWhat Tracepanel records
logginglogging_enabledEach log record of a request, task or command, with the fields you pass in extra=, attached to the span it was logged in.
python-devtoolsdevtools_enabledEach debug() call of a request, task or command as a dump, in the call tree where it ran. See python-devtools.
Database driversdbapi_enabledEach statement of a driver you use without an ORM, as SQL with the same N+1, duplicate and slow checks as Django's ORM, and EXPLAIN in the console. It covers sqlite3, aiosqlite, psycopg 3, psycopg2, asyncpg, PyMySQL, mysqlclient, MySQL Connector/Python, aiomysql, asyncmy, python-oracledb, pyodbc and pymssql for SQL Server, where EXPLAIN shows the estimated plan, and Snowflake's connector, sync and snowflake.connector.aio, with its commit() and rollback(). A statement that an ORM runs through the driver is recorded once, by the ORM. Opening a connection is a span too: see Opening a connection.
HTTP clientshttp_clients_enabledEach outgoing call of urllib3 and what is built on it (requests), httpx and aiohttp, with its method, URL and status. Credentials and sensitive query values stay out of the URL. A status of 400 or more marks the call as failed. A call slower than slow_http_ms is slow. Each call carries a traceparent header. See Calls between apps.
AWSboto_enabledEach call of botocore's clients, boto3 and aiobotocore, named as AWS names it, such as S3 PutObject avatars/1.png, with its region, request id, retries and error code. See AWS.
OpenAIopenai_enabledEach chat completion, response and embeddings call of the openai SDK, sync or async, streamed or not. See LLM calls.
Anthropicanthropic_enabledEach message of the anthropic SDK, messages.stream() too. See LLM calls.
Redisredis_enabledEach command of redis-py and valkey-py, sync and async, with its key. A pipeline is one span. The commands that Django's cache or a task queue sends sit under that library's span.
Jinjajinja_enabledEach render of a Jinja template as a template span, named after its file: Starlette's and FastAPI's Jinja2Templates, Flask's render_template, Django's Jinja2 backend and a template your code renders. A query run inside it names the template. A template it includes or extends renders inside its span.
Celerycelery_enabledEach task run as a trace, linked to the request, task or command that queued it. The time in the queue, retries with their reason, failures, arguments and the result. Tasks that Celery beat sends count as scheduled. The tasks in flight show in the Tasks page's Now.
Dramatiqdramatiq_enabledThe same for each message an actor processes.
RQrq_enabledThe same for each job, through RQ's forking worker and for Queue(is_async=False). A queue with is_async=False has nothing in flight for Now.
Django Tasksdjango_tasks_enabledThe same for django.tasks on Django 6.0 and later, and for the django-tasks backport on Django 5.2.
Hueyhuey_enabledThe same for each task a consumer runs, plain or through huey.contrib.djhuey. Immediate mode runs a task inside its caller, with a trace and nothing in flight for Now.
django-q2django_q_enabledThe same for each task a cluster runs, with its worker and group. async_task and schedule are the enqueue. A hook is a trace of its own, linked to its task's.
Taskiqtaskiq_enabledThe same for each task a worker runs, through a middleware that Tracepanel puts first on every broker. Each .kiq() is the enqueue. The delay, priority and timeout labels show on the run.
FastStreamfaststream_enabledEach message a subscriber handles as a task trace named after the handler, on Kafka, RabbitMQ, NATS and Redis, with the broker, the topic or queue and the outcome. A publish carries the trace context in the message's headers, so the handler's trace links to the publisher's.
MongoDBmongodb_enabledEach command of pymongo's MongoClient and AsyncMongoClient, and of Motor, with its shape ({"find": "users", "filter": {"email": "?"}}), its values kept apart as SQL's, the database, the server and the line of code. Tracepanel keeps the values only with capture_sql_params. A find per item is an N+1, the same find twice a duplicate. A command slower than slow_sql_ms is a slow call, and its hint names the index it needs. Nothing to install beyond Tracepanel: it uses pymongo's own command monitoring, for the clients created after the app imports pymongo.
SQLAlchemysqlalchemy_enabledEvery statement of every engine as SQL, sync or async, with the same N+1 and duplicate checks as Django's ORM, and the number of rows it returned. Each transaction and savepoint. This covers SQLModel and Flask-SQLAlchemy too.
Strawberrystrawberry_enabledGraphQL requests named after the operation, such as GraphQL query PostList, and your resolvers as spans. Errors that Strawberry returns with HTTP 200.
Graphenegraphene_enabledThe same for graphene-django's GraphQLView: the operation, parse and validate, and your resolvers as spans. No Graphene MIDDLEWARE entry needed.
Django REST frameworkdrf_enabledThe view named after the ViewSet action, such as PostViewSet.list. Authentication, permissions with the class that refused, throttles, validation with the 400's errors, and serialization as steps.
Django Ninjaninja_enabledThe view named after the operation's function. Authentication, input validation with the 422's errors, and response serialization as steps.
Channelschannels_enabledEach WebSocket event as a trace. Group messages linked to the span that sent them. A message sent to a worker channel, the kind runworker listens on, is a task.
htmxnoneWhat sent each htmx request and the HX-* headers of the answer. A redirect or a whole page that htmx would swap into the page.
OpenTelemetryotel_enabledSpans from the OpenTelemetry instrumentations your app enables for systems Tracepanel has no integration for, such as gRPC, Elasticsearch or Kafka, in the call tree.

The optional extras pin the oldest version Tracepanel supports. The database drivers, the HTTP clients, AWS, OpenAI, Anthropic, Graphene and Redis have no extra.

LibraryExtraMinimum version
Djangodjango5.2
FastAPIfastapi0.142
Starlettestarlette0.40
Flaskflask3.0
Falconfalcon4.0
Celerycelery5.3
Dramatiqdramatiq1.17
RQrq2.0
Hueyhuey2.5
django-q2django-q21.9
Taskiqtaskiq0.13
FastStreamfaststream0.6
SQLAlchemysqlalchemy2.0
pymongomongodb4.13
Strawberrystrawberry0.250
Django REST frameworkdrf3.15
Django Ninjaninja1.4
Channelschannels4.2
OpenTelemetry SDKotel1.45
pip install "tracepanel[fastapi,celery]"

Logging

Tracepanel reads log records from Python's standard logging module. It adds no handler to any logger and leaves your logging configuration as it is. basicConfig(), Django's LOGGING and a worker that takes over the root logger all work as they did before.

Tracepanel sees each record when a logger hands it to its handlers. It keeps a record once, however many loggers and handlers the record passes through. A logger's level still applies. If a logger's level is INFO, its DEBUG records don't reach Tracepanel.

Tracepanel keeps up to 1000 records per trace. It counts the records past that limit in the trace's tracepanel.dropped_logs attribute. A record that carries an exception, as logger.exception() writes, keeps its traceback.

Pass fields in extra= as usual:

import logging

logger = logging.getLogger(__name__)

logger.info("Order paid", extra={"order_id": 42, "amount": 990})

Tracepanel stores each field under extra. with the name in lower case, such as extra.order_id. Characters other than letters, digits and underscores become an underscore. A string, number, boolean or None keeps its value. Any other value is stored as a short repr().

Tracepanel masks an extra= field whose name has one of these words, in any case, as a whole word of the name, so api_key, apiKey and csrftoken are masked and author or tokenizer aren't:

pass, passwd, password, secret, token, api_key, apikey, auth, cookie, session, csrf, signature, private

A card's number and security code are masked too, such as card_number, pan or cvc. A name about a secret, such as password_length or token_type, and a yes or no, such as has_password, are shown.

Tracepanel skips the records of these loggers and their children:

LoggerWhy
tracepanelTracepanel's own records.
django.db.backendsThe SQL echo. The SQL tab already shows every query.
celery.app.trace, celery.workerCelery's bookkeeping for each task, such as "Task x succeeded in 0.1s". The task's trace already shows its state and duration.
dramatiq.workerDramatiq's worker bookkeeping.
rq.worker, rq.jobRQ's bookkeeping, such as "Job OK".
taskiq.receiver, taskiq.retry_middleware, taskiq.smart_retry_middlewareTaskiq's bookkeeping, such as "Executing task".
django-qdjango-q2's bookkeeping, such as "Processed".
django.channels.server, daphne, uvicorn.access, gunicorn.access, hypercorn.accessServer access logs, such as "GET /items/1 200". The trace itself has the request line and the status.

To skip more loggers, list them in the ignore_loggers setting. Tracepanel skips each one with its children:

[tool.tracepanel]
ignore_loggers = ["botocore", "urllib3"]

See Logs for the Logs page and its search.

python-devtools

python-devtools' debug() is recorded as a dump, with no change to your code. devtools prints and returns as before:

from devtools import debug

debug(items, total)
shop/views.py:12 checkout
    items: [1, 2, 3] (list) len=3
    total: 3 (int)

The dump is a log record of the trace, logger devtools and level debug, on the span the call ran in. It keeps devtools' text and each argument: its expression or keyword, its value as devtools prints it, its type and its length. The call tree always shows it, as a DUMP row. debug.format() prints nothing and isn't recorded.

An argument whose expression or keyword names a secret, as in debug(password) or debug(value=api_key), is masked, in its value and in the text. So are the secrets inside a value, by their names: a dict's keys, the fields of a dataclass, an attrs class, a pydantic model or a namedtuple, an object's attributes, and an ORM's columns as devtools prints them. A card's number and a URL's credentials are masked too. A name is read word by word, so auth_token is masked and author or max_tokens aren't. See Dumps. The terminal still shows devtools' own text.

A value is cut at 16 KB. A debug() outside a trace, such as at startup, isn't recorded.

A with debug.timer("load"): block is a function span named after the timer, so its time shows in the call tree.

devtools_enabled = false, or TRACEPANEL_DEVTOOLS_ENABLED=0, turns it off. See Dumps for where dumps show.

Tasks and the request that queued them

When a request queues a task, the request's call tree shows the enqueue as a step. Each run of the task is a trace of its own that links back to that step. The same holds for a task queued by another task or by a command.

Each queue carries the link in its own way:

  • Celery puts the current trace and span in the message headers.
  • Dramatiq puts them in the message options.
  • RQ puts them in job.meta, which it saves with the job.
  • Taskiq puts them in the message's labels, and FastStream in its headers as traceparent.
  • Huey's messages carry nothing extra. The link waits in Huey's storage under tracepanel:<task id> until the task starts.
  • Django Tasks and django-q2 carry no headers. The agent links the run to its enqueue by the task id when it has both.

A task that runs inside the caller, such as an eager Celery task, a task on Django's ImmediateBackend, Huey's immediate mode, django-q2's sync=True or Taskiq's InMemoryBroker, links to the caller's span directly.

A task also records the run it follows (task.parent_id), the first task of its workflow (task.root_id) and its group (task.group_id). That covers Celery's chains, groups and chords, RQ's depends_on and Groups, Dramatiq's pipelines and groups, Huey's pipelines and chords, and any task sent from inside another task's run. The console shows a run's workflow as a graph, and the steps as related traces.

While a task is queued, running or waiting for a retry, the Tasks page's Now lists it, with the workers and what each runs. Celery, RQ, Dramatiq, Huey, django-q2, Taskiq, FastStream, Channels workers and Django Tasks tell the agent of each step as it happens, and each worker sends a heartbeat. A worker shows up as it starts, or with its first task on Django Tasks, and leaves Now as it stops. Tasks that run inside their caller send nothing. See Tasks.

Each run records how long the task waited in its queue before a worker took it. A wait over 1 s is a queue-wait issue: all the workers were busy. A run also records its worker, when a delayed task was due (task.eta), its priority, and the time limit that stopped it (task.timeout).

A task that a profiled request queues is profiled too, on the worker, and so are the tasks that run queues in turn. Django Tasks carry nothing to the worker, so their runs aren't profiled.

Tracepanel keeps task arguments and results for local debugging. They never leave your machine. The capture_task_args setting turns this off. The ignore_tasks setting leaves out tasks by name, such as celery.backend_cleanup.

Start a worker with tracepanel run, or in a Django project with tracepanel.django installed. The worker prints a line after each task with a link to its trace:

tracepanel run celery -A app worker

Channels

A WebSocket connection can stay open for hours, so Tracepanel doesn't make it one trace. The connect, each frame received, each message from the channel layer and the disconnect are traces of their own. Each links to the connect trace. Frames sent to the client and messages sent to the channel layer are spans. A group message links each handler it reaches to the span that sent it.

Background work through Channels is a task. A message sent to a worker channel, one whose name has no ! and that runworker listens on, is an enqueue, and the worker's handling of it is a task trace named after the consumer's handler, such as ThumbnailConsumer.thumbnails_generate. These runs show on the Tasks page and in its Now, with each runworker process as a worker.

htmx

Tracepanel reads the HX-* headers of every request that htmx sends, and of the answer. Two answers only show as a broken page. htmx follows a redirect and swaps in whatever the new URL returns. And a whole page can land where htmx expected a fragment. Tracepanel records both, and the agent reports them as issues.

Queries a library made

A query that no code of your project made, such as one from Django's admin, a paginator or a template tag, records the library code that asked for it as code.caller: the first frame past the ORM and the driver. The panel shows it where the query's place in your code would be, marked as a library's.

Opening a connection

Opening a database connection is a sql.connect span, such as connect snowflake or connect postgresql, with the database, the server and the line of code that opened it. The call tree counts it as database time, not as your code's. A Snowflake login over HTTPS can take seconds, and Django with CONN_MAX_AGE at 0 opens a connection on every request.

Who opens itWhat the span covers
SQLAlchemy's poolThe driver's connect, the dialect's first queries and your connect listeners. db.connection.pool is sqlalchemy, and the alias is the engine's.
DjangoThe driver's connect and Django's setup statements, under the DATABASES alias.
Your codeconnect() of Snowflake's connector, psycopg, psycopg2, asyncpg, PyMySQL or mysqlclient. A connection that psycopg_pool or asyncpg's pool opens names the pool.

A SQLite file opens in no time and gets no span. A request that takes a connection the pool already holds has no connect span: only the first request on a new connection pays for it.

Snowflake's connector talks to Snowflake over HTTP. Before 5.0 it does so through its own copy of requests and urllib3, and through aiohttp for snowflake.connector.aio. From 5.0 its Rust core makes the calls. Tracepanel records none of them as HTTP calls. Their time stays in the span they serve: the login in connect snowflake, each query's requests in its SQL span. They make no HTTP issues and carry no traceparent. The HTTP calls your app makes itself are recorded as before, while a statement runs too.

Rows a query returns

Each SQL query records how many rows it returned. Django and SQLAlchemy count the rows as they fetch them, sync or async, on every database. A driver you use directly gives its row count where it knows it, as psycopg and the MySQL drivers do. asyncpg gives its results, and sqlite3 and aiosqlite count the rows your code fetches.

A SELECT with no LIMIT that returned 1000 rows or more is a large-result issue. Its hint says how to page or stream the rows.

Blocking calls in async code

A sync call on an event loop's thread makes every other request on that loop wait. Tracepanel marks SQL, an HTTP call, a Redis command or a Django cache call that runs synchronously on the loop's thread, such as a sync driver in an async view or endpoint. The agent reports the calls from one place in your code as a blocking-call issue once they take 5 ms together. Its hint names the async client or driver to use instead.

Async clients aren't marked. Neither are sync calls in a thread of their own, such as sync_to_async(), asyncio.to_thread() or a sync view.

AWS

Each call that boto3 or aiobotocore makes through botocore is a span named as AWS names it, such as S3 PutObject avatars/1.png or DynamoDB Query users. It holds the service, the operation, the region, the request id, botocore's retries and the error code of a failed call, such as NoSuchKey. The HTTP requests of a call are part of its span, not calls of their own.

Each service lands where its kind of call does:

  • S3 calls are storage calls, with the bucket and the key as the path. The console's Storage page lists them.
  • DynamoDB calls are datastore commands, with the request's shape as the statement and its values kept apart, as SQL's are.
  • SQS's SendMessage and SNS's Publish are messages.
  • Any other service, such as Lambda, is an RPC call.

The N+1 and duplicate checks apply to all of them. A call made for a Django storage, a cache or a task queue sits inside that library's span, and an N+1 counts once, on the library's call. The requests that upload_file() and download_file() send from their own threads are in the trace. The console's AWS page lists every call. See AWS.

LLM calls

Each call to a model through the official openai and anthropic SDKs is an llm span, sync or async, streamed or not: OpenAI's chat completions, responses and embeddings, and Anthropic's messages. A span is named after the operation and the model, such as chat gpt-5. It holds OpenTelemetry's GenAI attributes: the provider, the model asked for and the one that answered, the request's settings, the finish reasons, the tools the model called and the tokens used, cached and reasoning ones included. A stream's span lasts until the app reads it to the end, closes it or drops it, and records the time to its first chunk. The HTTP requests of the call, one per attempt, are inside it, and a rate limit or an overloaded API is an error.

The messages themselves are your users' words, so Tracepanel leaves them out by default. capture_llm_content = true keeps them, masked and cut at max_body_kb. The call tree then shows them as a conversation.

The agent estimates each call's cost from its tokens and a dated table of list prices. A model the table doesn't list has no cost. To add models or change prices, point llm_prices at a JSON file of the same shape as the agent's llm-prices.json, relative to the project's directory:

[tool.tracepanel]
llm_prices = "llm-prices.json"

The agent the app starts reads it. Without the setting, the agent reads llm-prices.json in the store's directory, if there is one. See LLM calls for what the console shows.

Calls between apps

Tracepanel links the traces of two apps when one calls the other over HTTP. It uses the W3C trace context:

  • Each outgoing HTTP call from urllib3, requests, httpx or aiohttp carries a traceparent header. A request that sets its own traceparent keeps it.
  • A request that comes in with a traceparent continues that trace context. This works in Django, in ASGI apps such as FastAPI and Starlette, and in WSGI apps such as Flask and Falcon.

The call tree then shows the called app's trace under the call, opened: its view, its queries and its own calls, with the app's name. The other app can use any Tracepanel SDK or OpenTelemetry. You don't configure the header.

The two apps don't need to share an agent. When each runs in its own project with its own agent, the console asks the other agents on your machine for the call's trace, and links to that project's console. When both send to one agent, each under its own service name, the Services page also draws an arrow from app to app. See the agent and service settings in Configuration.

OpenTelemetry

A system that Tracepanel has no integration for may have an OpenTelemetry instrumentation. If your app already uses OpenTelemetry, enable the instrumentation as usual. Its spans show in the request, task or job they ran in, under the span that was current:

from opentelemetry import trace
from opentelemetry.instrumentation.grpc import GrpcInstrumentorClient
from opentelemetry.sdk.trace import TracerProvider

trace.set_tracer_provider(TracerProvider())
GrpcInstrumentorClient().instrument()

Each instrumentation is a package of its own, such as opentelemetry-instrumentation-grpc. You need it only for a system that Tracepanel doesn't record itself. Everything in the table above needs only pip install tracepanel.

Tracepanel joins the TracerProvider that your app sets, before or after Tracepanel starts. It never sets a provider itself, so your exporters keep working. Tracepanel drops OpenTelemetry spans for what it records itself, so nothing shows twice. That covers the frameworks, SQL and the database drivers, SQLAlchemy, the HTTP clients, Redis, pymongo, Celery and logging. The integration needs opentelemetry-sdk.

Turn an integration off

Each library integration except htmx has a <name>_enabled setting. Set it to false and Tracepanel leaves the library alone:

# pyproject.toml
[tool.tracepanel]
drf_enabled = false
celery_enabled = false
TRACEPANEL_DRF_ENABLED=false

In Django, the same names go in the TRACEPANEL dict. tracepanel config prints each setting from the files and variables, and where its value comes from. It doesn't read Django's settings. See Configuration.

Tracepanel reads the *_enabled settings when the app starts, and patches each library when the app first imports it. Restart the app after you change an *_enabled setting.

On this page