Closed
Description
The problem I currently have is that there is no good way to flush traces/logs/metrics/errors once the runtime has finished handling a message.
Currently the handling code is structured something like this:
let request_span = <create span for the request>
async {
<do parsing, call the user provider handler, catch panics etc>
}.instrument(tracing_span)
There are a couple of issues with this approach:
- The user provided handler is the only way or the end user to affect the loop and thus he has to e.g. flush spans inside the handler
- Since the handler can panic it is possible that the flushing is never done since it has to happen after the work has been done.
- The
request_span
span can not be flushed since it's finished after the user provided handler is provided. - If the handler fails on e.g. parsing there is no way for the end user to send the errors to their error reporting tool of choice because their handler was never run.
I think it would be very valuable that the runtime would provide a hook for the end user so that they can do cleanup after each invocation.
Metadata
Metadata
Assignees
Labels
No labels