Skip to content

handlers

Event filtering and processing handlers for Sentry.

Functions:

Functions

before_send

Python
before_send(event: Event, hint: dict[str, Any]) -> Event | None

Filter and modify events before sending to Sentry.

Parameters:

  • event (Event) –

    The Sentry event to potentially filter or modify.

  • hint (dict[str, Any]) –

    Additional context about the event.

Returns:

  • Event | None

    The event if it should be sent, None if it should be filtered out.

before_send_transaction

Python
before_send_transaction(event: Event, hint: dict[str, Any]) -> Event | None

Filter and group spans before sending transaction events.

Parameters:

  • event (Event) –

    The transaction event to process.

  • hint (dict[str, Any]) –

    Additional context about the transaction.

Returns:

  • Event | None

    The modified transaction event.

traces_sampler

Python
traces_sampler(sampling_context: dict[str, Any]) -> float

Determine sampling rate for traces based on context.

Returns:

  • float

    Sampling rate between 0.0 and 1.0.

get_span_operation_mapping

Python
get_span_operation_mapping(op: str) -> str

Map span operations to standardized names.

Returns:

  • str

    Standardized operation name.

get_transaction_operation_mapping

Python
get_transaction_operation_mapping(transaction_name: str) -> str

Map transaction names to standardized operations.

Returns:

  • str

    Standardized operation name.

_filter_and_group_spans

Python
_filter_and_group_spans(spans: list[dict[str, Any]]) -> list[dict[str, Any]]

Filter and group spans to reduce noise.

Returns: