logfire icon indicating copy to clipboard operation
logfire copied to clipboard

Docs Should Better Explain How To Instrument Django ORM

Open pythonweb2 opened this issue 9 months ago • 1 comments

A common thing that a django app may want to do is instrument the ORM queries, but the docs are not clear on how to do this. Could a section be added to the docs, something like this?

Instrumenting Django ORM Queries

To instrument Django ORM queries, you need to install the associated DB instrumentation tool, then add the corresponding instrumentation command to your settings.py file. For example, if your app is using psycopg, you would do this.

uv add logfire[psycopg]

settings.py

logfire.instrument_psycopg("psycopg")

pythonweb2 avatar Mar 28 '25 13:03 pythonweb2

Agreed, happy for a PR about this.

Somewhat related is https://github.com/pydantic/logfire/issues/620

Also see https://github.com/open-telemetry/opentelemetry-python-contrib/issues/856

alexmojaki avatar May 27 '25 14:05 alexmojaki