-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs: add SpanId
and ActivityId
to each LogEvent
producer by ILoggingAdapter
#6855
Comments
Just circling around to the linked issue :-) ... would the end result be better/worse for Akka.net depending on whether we push that one forward? |
Took a look at this some today and it's not going to be as simple as I thought:
Given the asynchronous way we process logs, this is problematic - we can capture the
protected virtual void Log(LogEvent log, ActorPath path)
{
// this is going to be `null` 99.9999999999999999% of the time
var previous = Activity.Current;
try{
Activity.Current = log.Activity; // grab the activity from the ILoggingAdapter output
// the OTEL logger, if configured, will pick it up here
_akkaLogger.Log<LogEvent>(GetLogLevel(log.LogLevel()), new EventId(), log, log.Cause, (@event, exception) => @event.ToString());
}
finally{
Activity.Current = previous; // put the old value back on the stack
}
} I don't see any reason why that wouldn't work - maybe we can give that a shot. |
And we can still, of course, append the |
Is your feature request related to a problem? Please describe.
Related: serilog/serilog#1923
Will add some overhead to our logging system (System.Diagnostics.Activity is in the BCL, so no extra dependencies though) but might make it much easier to correlate Akka.NET system + user actor activity to traces in the future.
The text was updated successfully, but these errors were encountered: