Peter,
What I meant is that a solution for doing that would be either by instrumentation (eg of BlockingQueue implementations in this case) or through the API, but not both (as your initial post seemed to ask about both).
Writing a robust, reliable, generic and performant enough plugin for such a use case is not trivial, but I believe you can use the public API to achieve what you want.
I just opened this pull request to demonstrate how you can do that.
In this case I used a wrapper to wrap the queued elements alongside an Elastic APM span, but that could be done in other ways of course. My assumption is that since you are able to use the API, you are also able to adjust your code to change the queue usage. You should find the way that suits your code the most with regard to where and how you actually correlate queued elements to spans.
You should be able to apply the concept demonstrated in this PR to your custom threads as well.
I hope this helps.
Eyal.