Uploaded image for project: 'Rust Driver'
  1. Rust Driver
  2. RUST-2032

mongo-rust-driver - PR #1201: track task spawn location for tokio instrumentation

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 3.2.0
    • Affects Version/s: None
    • Component/s: None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      hds has created PR #1201: track task spawn location for tokio instrumentation in mongo-rust-driver

      Issue Text:
      The tracing instrumentation present in tokio (which feeds into
      tokio-console) tracks the spawning location of each task. This can be
      useful in understanding what each task is doing, especially if the tasks
      aren't named (which is a `tokio_unstable` feature so not usually present
      in published crates).

      The location tracking isn't as useful when tasks are spawned from some
      central location like the `mongodb` crate does, because all tasks have
      the same spawn location. However, since the instrumentation uses the
      `panic:Location` to determine the spawn location, the `#[track_caller]`
      attribute macro can be used to ensure that the actual location is picked
      up instead of the common one.

      A side effect of using the `#[track_caller]` attribute is that the
      single line output in the case of a panic (when `RUST_BACKTRACE` isn't
      set) will point to the callsite in the code, and not the common site -
      although this is often desirable anyway.

      This change adds `#[track_caller]` to the `pub(crate)` function
      `crate::runtime::spawn` as well as the method `AsyncJoinHandle::spawn`.

            Assignee:
            abraham.egnor@mongodb.com Abraham Egnor
            Reporter:
            tom.selander@mongodb.com Tom Selander
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: