From (lightly edited) chatlogs, h/t @handpickencounter:
Are you referring to gvisor's systrap? They use SECCOMP_RET_TRAP and probably the only documentation of how to use it to replace ptrace well is in their source.
It might be worth checking out, they replaced their ptrace with SECCOMP_RET_TRAP as the default. and claim much better performance.
https://github.com/google/gvisor/tree/master/pkg/sentry/platform/systrap
reading about strace's use of seccomp its probably another good option. selective ptrace will have a trivial performance impact. gvisor intercepts every single syscall after all.
From (lightly edited) chatlogs, h/t @handpickencounter:
There's also a maybe-related paper from our friends at NRL/Tor: https://www.usenix.org/conference/atc22/presentation/jansen