Another option is tail based sampling which allows you to make the choice at the end of the request whether to keep the trace.
With that you could configure the APM to keep the first $N traces for all endpoints and then start sampling after that
That’s an interesting idea! Reminds me of how Pyroscope’s continuous profiling data can be linked to OpenTelemetry traces[1].
A lot of these tools sample stack traces at intervals, collecting statistics of how often functions are used. If you had enough samples, then with very high confidence you could find code paths that are never used in production.