Skip to content

only_slow_query.py

OnlySlowQueryPresenter (BasePresenter) ยค

Only queries exceeding the SLOW_MIN_SECOND threshold are output.

Source code in presenter/only_slow_query.py
class OnlySlowQueryPresenter(BasePresenter):
    """
    Only queries exceeding the [SLOW_MIN_SECOND](../../home/settings.md) threshold are output.
    """

    def print(self) -> None:
        for captured_query in self.classified_query["slow_captured_queries"]:
            print(
                colorize(
                    f'{get_stack_prefix(captured_query)} Slow {captured_query["duration"]:.2f} seconds',
                    is_warning=True,
                )
            )