inline suspend fun ThreadLocal<*>.isPresent(): Boolean(source)

Return true when current thread local is present in the coroutine context, false otherwise. Thread local can be present in the context only if it was added via asContextElement to the context.

Example of usage:

suspend fun processRequest() {
if (traceCurrentRequestThreadLocal.isPresent()) { // Probabilistic tracing
// Do some heavy-weight tracing
// Process request regularly