← All platforms

Google Cloud Functions (Python) error tracking

A function can be short-lived without its errors being short-lived. Use the Sentry Python SDK to send Google Cloud Functions reports to your Telebugs server.

~/hoofnotes  pip install sentry-sdk
~/hoofnotes  nvim main.py
import sentry_sdk
from sentry_sdk.integrations.gcp import GcpIntegration
sentry_sdk.init(
# Copy the complete Telebugs DSN, key and path included.
dsn="YOUR_TELEBUGS_DSN",
integrations=[GcpIntegration()],
)
from hoofnotes.handlers import save_note
~/hoofnotes  functions-framework --target save_note

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep sentry-sdk and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

HTTP functions or background events?

The Google Cloud Functions integration supports reporting Python exceptions from function invocations. Telebugs stores the exception and the context the SDK includes.

Can the function stay on Google Cloud?

Of course. Self-hosted describes your error tracker, not a requirement to move your app. Your function just needs network access to your Telebugs endpoint.