# _sentry

URL: /pounce/api/_sentry/
Section: api
Description: Sentry error tracking integration for pounce.

Optional integration with Sentry SDK for automatic error reporting,
performance monitoring, and request context capture.

---

> For a complete page index, fetch /pounce/llms.txt.

Open LLM text
(/pounce/api/_sentry/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_sentry%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_sentry%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_sentry%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_sentry%2Findex.txt)

Module

#
`_sentry`

Sentry error tracking integration for pounce.

Optional integration with Sentry SDK for automatic error reporting,
performance monitoring, and request context capture.

11Functions

## Functions

`is_sentry_available`

0

`bool`

▼

Check if Sentry SDK is installed.

`def is_sentry_available() -> bool`

##### Returns

`bool`

`init_sentry`

7

`None`

▼

Initialize Sentry SDK.

`def init_sentry(dsn: str, *, environment: str | None = None, release: str | None = None, traces_sample_rate: float = 0.1, profiles_sample_rate: float = 0.1, server_name: str | None = None, debug: bool = False) -> None`

##### Parameters

Name
Type
Description

`dsn`
`str`

Sentry DSN (Data Source Name)

`environment`
`str | None`

Environment name (e.g., "production", "staging")

Default:`None`

`release`
`str | None`

Release version (e.g., "myapp@1.0.0")

Default:`None`

`traces_sample_rate`
`float`

Sample rate for performance monitoring (0.0-1.0)

Default:`0.1`

`profiles_sample_rate`
`float`

Sample rate for profiling (0.0-1.0)

Default:`0.1`

`server_name`
`str | None`

Server name for tagging

Default:`None`

`debug`
`bool`

Enable debug mode

Default:`False`

`create_sentry_wrapper`

1

`ASGIApp`

▼

Wrap an ASGI app with Sentry error tracking.

Automatically captures exceptions…

`def create_sentry_wrapper(app: ASGIApp) -> ASGIApp`

Wrap an ASGI app with Sentry error tracking.

Automatically captures exceptions, request context, and performance data.

##### Parameters

Name
Type
Description

`app`
`ASGIApp`

Original ASGI app

##### Returns

`ASGIApp`

`capture_exception`

4

`str | None`

▼

Manually capture an exception to Sentry.

`def capture_exception(error: Exception, *, level: str = 'error', tags: dict[str, Any] | None = None, extra: dict[str, Any] | None = None) -> str | None`

##### Parameters

Name
Type
Description

`error`
`Exception`

Exception to capture

`level`
`str`

Severity level ("fatal", "error", "warning", "info", "debug")

Default:`'error'`

`tags`
`dict[str, Any] | None`

Tags to attach to event

Default:`None`

`extra`
`dict[str, Any] | None`

Extra context data

Default:`None`

##### Returns

`str | None`

`capture_message`

4

`str | None`

▼

Manually capture a message to Sentry.

`def capture_message(message: str, *, level: LogLevelStr = 'info', tags: dict[str, Any] | None = None, extra: dict[str, Any] | None = None) -> str | None`

##### Parameters

Name
Type
Description

`message`
`str`

Message to capture

`level`
`LogLevelStr`

Severity level ("fatal", "error", "warning", "info", "debug")

Default:`'info'`

`tags`
`dict[str, Any] | None`

Tags to attach to event

Default:`None`

`extra`
`dict[str, Any] | None`

Extra context data

Default:`None`

##### Returns

`str | None`

`add_breadcrumb`

4

`None`

▼

Add a breadcrumb for context.

Breadcrumbs are added to error reports for debug…

`def add_breadcrumb(message: str, *, category: str | None = None, level: str = 'info', data: dict[str, Any] | None = None) -> None`

Add a breadcrumb for context.

Breadcrumbs are added to error reports for debugging context.

##### Parameters

Name
Type
Description

`message`
`str`

Breadcrumb message

`category`
`str | None`

Category (e.g., "auth", "database", "http")

Default:`None`

`level`
`str`

Severity level

Default:`'info'`

`data`
`dict[str, Any] | None`

Additional data

Default:`None`

`set_user`

5

`None`

▼

Set user context for error reports.

`def set_user(user_id: str | None = None, *, email: str | None = None, username: str | None = None, ip_address: str | None = None, **extra: Any) -> None`

##### Parameters

Name
Type
Description

`user_id`
`str | None`

User ID

Default:`None`

`email`
`str | None`

User email

Default:`None`

`username`
`str | None`

Username

Default:`None`

`ip_address`
`str | None`

User IP address **extra: Additional user data

Default:`None`

`**extra`
`Any`

`set_tag`

2

`None`

▼

Set a tag for the current scope.

`def set_tag(key: str, value: Any) -> None`

##### Parameters

Name
Type
Description

`key`
`str`

Tag key

`value`
`Any`

Tag value

`set_context`

2

`None`

▼

Set context data for the current scope.

`def set_context(key: str, value: dict[str, Any]) -> None`

##### Parameters

Name
Type
Description

`key`
`str`

Context key

`value`
`dict[str, Any]`

Context data (must be dict)

`start_transaction`

2

`Any`

▼

Start a performance transaction.

`def start_transaction(name: str, op: str = 'http.server') -> Any`

##### Parameters

Name
Type
Description

`name`
`str`

Transaction name (e.g., "GET /api/users")

`op`
`str`

Operation type

Default:`'http.server'`

##### Returns

`Any`

`flush`

1

`bool`

▼

Flush pending events to Sentry.

Useful before shutdown to ensure all events ar…

`def flush(timeout: float = 2.0) -> bool`

Flush pending events to Sentry.

Useful before shutdown to ensure all events are sent.

##### Parameters

Name
Type
Description

`timeout`
`float`

Maximum time to wait (seconds)

Default:`2.0`

##### Returns

`bool`
