Skip to content

Send logs and events from Python apps to Honeybadger Insights

View Markdown

When enabled, Honeybadger automatically instruments your Python application to send application events to Honeybadger Insights. This is the easiest way to get started with Insights. To get started, enable Insights in your app configuration:

from honeybadger import honeybadger
honeybadger.configure(insights_enabled=True)

Once integrated with our middleware or extensions, Honeybadger instruments the following libraries:

  • Django requests & database queries
  • Flask requests & database queries
  • ASGI requests (FastAPI, Starlette, etc.)
  • Celery tasks
  • Oban workers & maintenance loops

See the automatic instrumentation guide to learn how to configure each integration, and the Python event reference for every event the package emits, with field schemas and types. You can also add extra context data to events, filter events to remove PII, and sample events to reduce the amount of data sent to Honeybadger.

Once events are flowing into Insights, you can query them with BadgerQL. For example, to find your slowest Django views:

filter event_type::str == "django.request"
| stats avg(duration::float) as avg_duration, count() as requests by view::str
| sort avg_duration desc

Or to see Oban background-job throughput and p95 duration by worker:

filter event_type::str == "oban.job_finished"
| stats count() as jobs, percentile(95, duration::float) as p95_ms by worker::str
| sort jobs desc

The Python event reference lists the fields available on each event type.

If you have custom events you’d like to track, use honeybadger.event to report them to Insights:

from honeybadger import honeybadger
honeybadger.event("user.signup", {"user_id": user.id, "plan": user.plan})

More information about sending events to Insights from your Python apps can be found here.

Honeybadger isn’t just for errors and application data! You can use our syslog, Vector, or PaaS integrations to send additional data from your infrastructure to Honeybadger Insights, where you can query, visualize, and analyze all of your production data in one place.