huey
Learn how to import and use the huey integration.
The huey integration adds support for the huey task queue library.
To get started, install sentry-sdk
from PyPI.
Copied
pip install --upgrade sentry-sdk
The huey integration is enabled automatically if you have the huey
package installed.
Configuration should happen as early as possible in your application's lifecycle.
Copied
import sentry_sdk
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
)
Copied
from huey import SqliteHuey
sentry_sdk.init(...) # same as above
huey = SqliteHuey(filename='demo.db')
@huey.task()
def add(a, b):
return a + b
with sentry_sdk.start_transaction(name="testing_huey"):
result = add(1, 2)
Running this will create a new transaction called testing_huey
in the Performance section of sentry.io. It may take a couple of moments for the transaction to show up.
- huey: 2.0+
- Python: 3.6+
The versions above apply for Sentry Python SDK version 2.0+
, which drops support for some legacy Python and framework versions. If you're looking to use Sentry with older Python or framework versions, consider using an SDK version from the 1.x
major line of releases.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").