Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-100117

Create Traceable interface and make OpCtx inherit from it

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Networking & Observability
    • 2

      In order to support trace context propagation we want to have a generic Traceable interface for objects that might contain a trace context :

      // Traceable MUST only be used by a single thread. If a new thread is spawned in a sub-operation this thread MUST have its own Traceable copy.
      class Traceable {
      public:
          struct SpanContext {}
          Traceable(const Traceable& t) : _context(deep_copy(t._context)) {}
          // MUST be used by a single thread only.
          void setActiveContext(std::shared_ptr<BaseContext> context) {
              _context = std::move(context);
          }
      
          // MUST be used by a single thread only.
          std::shared_ptr<BaseContext> getActiveContext() const {
              return _context;
          }
      private:
          std::shared_ptr<SpanContext> _context;
      };
      

      We also want to make OperationContext inherit from it to have easily trace most of the server codebase.

            Assignee:
            Unassigned Unassigned
            Reporter:
            didier.nadeau@mongodb.com Didier Nadeau
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: