Closed alekdavisintel closed 4 months ago
Hi! Your note made me aware that the 3.1.0 release notes hadn't been published, which they now have :-)
https://github.com/nblumhardt/serilog-timings/releases/tag/v3.1.0
In there is a note on the status of this project, essentially that no new functionality is planned here, with SerilogTracing taking over instead:
https://nblumhardt.com/2024/03/from-serilog-timings-to-tracing/
SerilogTracing has a few advantages, but aside from the documented ones, it's also intended to be a long-lived community project, either in the current form or as part of Serilog proper, while this library has been in "side project" mode for many years.
SerilogTracing has a different API, which makes the message template fully user-configurable.
Having noticed that you've got some pretty tight formatting requirements, if you decide to use SerilogTracing and need to integrate span (operation) timings into your output, there are two approaches to try.
One, you can use .Enrich.WithSpanTimingMilliseconds()
to get an ElapsedMilliseconds
(IIRC) property onto span events.
The other is to use formatting functions from SerilogTracing.Expressions
and its name resolver, TracingNameResolver
, which provides helpers like IsSpan()
etc. If you do that, you might take a look at replicating OrderedNameResolver
as a way to combine your custom formatting functions and SerilogTracing's (there's no good public API for combining name resolvers in Serilog.Expressions yet, that I can recall).
Ah, thanks. With my other issue (https://github.com/serilog/serilog/issues/2059) resolved, this is no longer a problem. We will stick with the SerilogTimings
for now. It is simple and it works. Since timing is the only thing we use, I do not see a reason to complicate things.
Thanks for the follow-up :+1:
I have looked but could not find how to customize the SerilogTimings message template. In particular, I want to get rid of the quotes around
completed
andabandoned
in the completion message. I get them quoted because I'm using a custom message enricher and at this time I did not figure out how to turn off automatic quoting of the message string parameters, but that's a different issue. As a workaround I append:l
to the parameter placeholders, but to do this for the SerilogTimings message, I need to access the message template and I cannot find any documentation or posts explaining how to do this. Not sure if this is possible, but it would be nice to have.