[ty] Speedup tracing checks by MichaReiser · Pull Request #19965 · astral-sh/ruff (original) (raw)

Summary

Overriding callsite_enabled in the filter allows tracing to short-circuit many tracing calls that are known to always be off by leverging caching.

The implementation follows the recommended implementation of the Filter trait if the filtering isn't based on any dynamic data (which isn't the case for us)

Test Plan

Tested that the server still sends logs for ruff/ty tracing calls