On 24/10/2025 13:54, Wesley Hill wrote:
Hi, and thanks for your work on StructuredTaskScope. I recently adapted it for use in our services to handle (a) propagation of the OpenTelemetry Context, and (b) the richer cancellation model we use. Overall it went fairly well, and I'll give a few details and some minor feedback in case that's of interest.

Background: We have an implementation of io.opentelemetry.context.Context for the usual purposes of passing around tracing, logging, authentication, and other context. We also added a cancellation signal in that Context implementation, very much along the lines of grpc-java's Context/CancellableContext classes (which also makes it similar to golang's Context). Cancelling a parent Context cancels all the child contexts, and a Context can cancel itself when it reaches a Deadline, and callbacks can be registered to run upon cancellation. We do this because thread interruption alone is not a sufficient approach for cancellation when we need to cancel things like HTTP or gRPC calls, JDBC Statements, and other I/O which isn't interruptible. (I understand that it's not a goal of the current structured concurrency JEPs to improve cancellation beyond thread interruption).

Thanks for writing up your experiences. What pain points would have remain if somehow OpenTelemetry could use ScopedValues?

-Alan

Reply via email to