Skip to content

Throttle filter

This page is auto-generated for FilterType.Throttle.

Spec

  • Filter type: Throttle (throttle)
  • Filter class: ThrottleFilter
  • Filter class FQDN: daqpytools.logging.filters.ThrottleFilter
  • Factory: _build_throttle_filter
  • Factory FQDN: daqpytools.logging.filters._build_throttle_filter
  • Fallback types: throttle
  • Summary: Build a throttle filter.

Factory API

daqpytools.logging.filters._build_throttle_filter(fallback_handlers, initial_treshold=30, time_limit=30, **extras)

Build a throttle filter.

Parameters:

Name Type Description Default
fallback_handlers set[HandlerType]

Handler types used as fallback routing context.

required
initial_treshold int

Number of first occurrences to emit before applying suppression logic.

30
time_limit int

Throttle time window in seconds.

30
**extras object

Additional forwarded keyword arguments. Ignored by this factory.

{}

Returns:

Type Description
Filter

A configured ThrottleFilter instance.

Notes

The keyword name is currently initial_treshold to match the existing function signature.

Source code in daqpytools/logging/filters.py
def _build_throttle_filter(
    fallback_handlers: set[HandlerType],
    initial_treshold : int = 30,
    time_limit: int = 30,
    **extras: object,
) -> logging.Filter:
    """Build a throttle filter.

    Args:
        fallback_handlers: Handler types used as fallback routing context.
        initial_treshold: Number of first occurrences to emit before applying
            suppression logic.
        time_limit: Throttle time window in seconds.
        **extras: Additional forwarded keyword arguments. Ignored by this
            factory.

    Returns:
        A configured ``ThrottleFilter`` instance.

    Notes:
        The keyword name is currently ``initial_treshold`` to match the
        existing function signature.
    """
    del extras
    return ThrottleFilter(
        fallback_handlers=fallback_handlers,
        initial_threshold=initial_treshold,
        time_limit=time_limit
    )