This feature will resolve issue #126. See this comment for details.
Add an option to SentryAspNetCoreOptions named FlushOnCompletedRequest of type bool and a FlushTimeout with default value of Timestamp.FromSeconds(2).
Inside SentryMiddleware, check for this flag in the options and if opt in, add to context.Response.OnCompletd like the snippet from @madmox in #126:
context.Response.OnCompleted(async () =>
{
await sentryClient.FlushAsync(timeout: _options.FlushTimeout);
});
await this._next(context);
Tests are required to assert FlushAsync isn't called by default and when the flag is set to false. And otherwise it is called with the default Timeout. Modifying the timeout should affect the parameter passed to FlushAsync.
This feature will resolve issue #126. See this comment for details.
Add an option to
SentryAspNetCoreOptionsnamedFlushOnCompletedRequestof typebooland aFlushTimeoutwith default value ofTimestamp.FromSeconds(2).Inside
SentryMiddleware, check for this flag in the options and if opt in, add tocontext.Response.OnCompletdlike the snippet from @madmox in #126:Tests are required to assert
FlushAsyncisn't called by default and when the flag is set tofalse. And otherwise it is called with the default Timeout. Modifying the timeout should affect the parameter passed toFlushAsync.