sentry-rust icon indicating copy to clipboard operation
sentry-rust copied to clipboard

before_send_async

Open alex35mil opened this issue 1 year ago • 2 comments
trafficstars

We need to do some async stuff in the before_send hook, but seems like it's not possible without using block_on. I would appreciate if you consider adding an async version of the hook or suggest another way to handle it with the current API.

alex35mil avatar Oct 31 '24 07:10 alex35mil

Hi @alex35mil, thanks for the suggestion. It will probably take us some time to get around to implementing a before_send_async function. If you would like a quicker resolution, I would suggest opening a PR

szokeasaurusrex avatar Dec 11 '24 16:12 szokeasaurusrex

Hey, @szokeasaurusrex, I tried to make it async back then and stopped when the changed api interfered with some sync integrations, such as log.

For now, we just block_in_place:

use tokio::{runtime, task};

task::block_in_place(|| {
    let runtime = runtime::Handle::current();
    runtime.block_on(future)
});

alex35mil avatar Dec 27 '24 06:12 alex35mil