Skip to content

Using TaskMonitor with spawn_blocking? #62

@AlJohri

Description

@AlJohri

Is it possible to instrument a spawn_blocking task? I am currently getting this error when I try to instrument the closure being passed into spawn blocking:

expected an `FnOnce()` closure, found `tokio_metrics::Instrumented<{closure@amzn-eureka-broker-node/src/search.rs:604:18: 604:25}>

Our application makes heavy use of both tokio::spawn and tokio::spawn_blocking and I would like to see metrics for both parts of the application.

I think some of the metrics still make sense in the spawn_blocking context like total_first_poll_delay.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions