ReactiveX / RxSwift

Reactive Programming in Swift
MIT License
24.41k stars 4.17k forks source link

Context propagation #2517

Closed SebastianThiebaud closed 1 year ago

SebastianThiebaud commented 1 year ago

If this isn't the right place to open a feature request, let me know, and I'll repost it in the right forum.

This is related to Apple's distributed tracing guidelines for Swift (and more specifically, Swift 5.5) https://github.com/apple/swift-distributed-tracing-baggage https://github.com/apple/swift-distributed-tracing

According to OpenTelemetry and Apple: in a distributed system (or a mobile application composed of several frameworks), a context is passed from senders to receivers. The context refers to metadata collected, stored, and carried across API and framework boundaries by components within a distributed system and between logically associated execution units. These execution-scoped values include information such as IDs, request methods, and versions. A context must be immutable, and its write operations must result in the creation of a new context containing the original and updated values.

When RxSwift's observables and operators are used within an application, new execution units are created and do not carry over the current context (task local values). In this case, the current context should be copied so the new detached task can pass along the baggage and all its data.

I'd love to hear if there is any plan to support context propagation within RxSwift.

Thank you.

freak4pc commented 1 year ago

Hey, @SebastianThiebaud

RxSwift is mainly in maintenance and minor enhancements mode to provide solid support for the existing project API surface. We don't plan on making any large feature additions and can't imagine we'll have anyone working on supporting Distributed Tracing with RxSwift itself.

I don't oppose any PRs on the topic but as mentioned, it's not on the roadmap.