---
title: Automatic instrumentation
description: Events the Honeybadger Python package captures automatically from Django, Flask, Celery, and more for Honeybadger Insights.
url: https://docs.honeybadger.io/lib/python/insights/automatic-instrumentation/
---

Honeybadger Insights allows you to automatically track various events in your application. To enable Insights automatic instrumentation, add the following to your configuration:

```python
from honeybadger import honeybadger


honeybadger.configure(insights_enabled=True)
```

## Supported libraries

*After integration with our middleware or extensions*, Honeybadger will automatically instrument the following libraries:

* **Django** requests & database queries
* **Flask** requests & database queries
* **ASGI** requests
* **Celery** tasks

See the [Python event reference](https://docs.honeybadger.io/insights/event-types/python/) for every event the package emits, with field schemas and types.

You can configure the instrumentation for specific libraries / components by passing a dictionary to a specialized `insights_config` parameter.

By default, all keyword dict params are run through our `params_filters`.

### Django

Django instrumentation captures these event types:

django.request db.query

Database events are configured in [their own section](https://docs.honeybadger.io/lib/python/insights/automatic-instrumentation/#database), but are emitted automatically by the Django instrumentation.

You can configure the Django instrumentation by passing a dictionary to `insights_config`:

```python
honeybadger.configure(
    insights_config={
        "django": {
            # Disable instrumentation for Django, defaults to False
            "disabled": True,
            # include GET/POST params in events, defaults to False
            "include_params": True,
        }
    }
)
```

### Flask

Flask instrumentation captures these event types:

flask.request db.query

Database events are configured in [their own section](https://docs.honeybadger.io/lib/python/insights/automatic-instrumentation/#database), but are emitted automatically by the Flask instrumentation.

You can configure the Flask instrumentation by passing a dictionary to `insights_config`:

```python
honeybadger.configure(
    insights_config={
        "flask": {
            # Disable instrumentation for Flask, defaults to False
            "disabled": True,
            # Include GET/POST params in events, defaults to False
            "include_params": True,
        }
    }
)
```

### ASGI

ASGI instrumentation captures these event types:

asgi.request

You can configure the ASGI instrumentation by passing a dictionary to `insights_config`:

```python
honeybadger.configure(
    insights_config={
        "asgi": {
            # Disable instrumentation for ASGI, defaults to False
            "disabled": True,
            # Include query params in events, defaults to False
            "include_params": True,
        }
    }
)
```

### Celery

Celery instrumentation captures these event types:

celery.task\_finished

You can configure the Celery instrumentation by passing a dictionary to `insights_config`:

```python
import re
from honeybadger import honeybadger


honeybadger.configure(
    insights_config={
        "celery": {
            # Disable instrumentation for Celery, defaults to False
            "disabled": True,
            # Include task args/kwargs, defaults to False
            "include_args": True,
            # List of task names or regexes to exclude, defaults to []
            "exclude_tasks": [
                "tasks.cleanup",
                re.compile("^internal_"),
            ],
        }
    }
)
```

### Database

Honeybadger can capture database queries for supported libraries like Django ORM and SQLAlchemy. The event types captured include:

db.query

These events are emitted as a side effect other instrumentation, such as Django or Flask, so you don’t need to enable them separately.

You can configure the database instrumentation by passing a dictionary to `insights_config`:

```python
import re
from honeybadger import honeybadger
from honeybadger.config import default_excluded_queries


honeybadger.configure(
    insights_config={
        "db": {
            # Disable instrumentation for DB, defaults to False
            "disabled": True,
            # Include SQL params in events, defaults to False
            "include_params": True,


            # List of queries to exclude (strings or regexes), defaults to
            # common system queries
            "exclude_queries": [
                "django_admin_log",                 # Matches any query containing this string
                re.compile(r".*auth_permission.*"), # Regex pattern
            ],


            # To add to the default excluded queries, import and use the default_excluded_queries function
            "exclude_queries": default_excluded_queries() + [
                re.compile(r".*my_custom_table.*"),
                "my_system_query",
            ],
        }
    }
)
```

## Sending your own events

Automatic instrumentation covers the libraries the package knows about. To send your own application events, see [Sending custom events](https://docs.honeybadger.io/lib/python/insights/sending-custom-events/).

## Sending logs from your infrastructure

Honeybadger isn’t just for errors and application data! You can use our [syslog](https://docs.honeybadger.io/guides/insights/integrations/systemd/), [Vector](https://docs.honeybadger.io/guides/insights/integrations/log-files/), or [PaaS integrations](https://docs.honeybadger.io/guides/insights/#adding-data-from-other-sources) to send additional data from your infrastructure to [Honeybadger Insights](https://docs.honeybadger.io/guides/insights/), where you can query, visualize, and analyze all of your production data in one place.

---

## Try Honeybadger for FREE

Intelligent logging, error tracking, and Just Enough APM™ in one dev-friendly platform. Find and fix problems before users notice.

[Start free trial](https://app.honeybadger.io/users/sign_up)

[See plans and pricing](https://www.honeybadger.io/plans/)
