I'm using SerilogMetrics's BeginTimedOperation()
in a Web API, and it would be really great to be able to use the HttpRequestNumber
or HttpRequestId
properties (from the respective Serilog.Extra.Web enrichers) as the identifier, making it super easy to correlate timing-related log entries with others across a request.
Something like:
using (logger.BeginTimedOperation("doing some work", HttpRequestNumberEnricher.CurrentRequestNumber))
{ ... }
Short of poking around in HttpContext.Current
for the magically- (i.e. non-public) named properties, is this achievable? Thanks!