feat: Add hooks for easy performance tracing #3735
Labels
enhancement candidate
Candidate for enhancement but additional research is needed
pkg:bloc
This issue is related to the bloc package
Description
I'm currently experimenting with automatic performance tracing for blocs. For that I would like to hook somehow into blocs easily.
I'm especially interested in tracing the time an
EventHandler
takes to execute. That method basically represents the code which is executed after adding an event until that work is handled. At least that's my understanding.By performance tracing I mean to trace it with tools like Sentry, Datadog, etc. I don't mean the Dart Dev Tools.
Desired Solution
I think I need some hooks around this code:
bloc/packages/bloc/lib/src/bloc.dart
Lines 224 to 232 in e51483d
Ideally, I'm also able to wrap
await handler(event as E, emitter);
somehow myself in a try catch so that I can set the status of the trace to something like success/failure.Something like the following pseudo code would be sufficient:
Alternatives Considered
I'm not really well versed with
bloc
so I'm not aware of any other possible approach. I'm therefore open for any alternative approaches or suggestions.Additional Context
The text was updated successfully, but these errors were encountered: