-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
EventSourceLogger does not propagate state data during ActivityStart #33486
Comments
Related pull requests: |
/cc: @tarekgh @shirhatti |
Wrong Saurabh ? :) |
sorry @saurabh500 :) updated |
@wiktork Do we need this for dotnet-monitor? |
I wouldn't say need, more of a nice to have. It's a gap between inproc ILoggers and what we can collect. |
@wiktork could you please share a small code snippet to illustrate this limitation a bit better and showcase the difference in behavior you found? |
We collect ActivityStart events that are emitted through EventSourceLogger: However, EventSourceLogger only cares about object state that is of a specific type: runtime/src/libraries/Microsoft.Extensions.Logging.EventSource/src/EventSourceLogger.cs Lines 196 to 199 in 6072e4d
In the Asp.net app: public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
_logger.BeginScope(new Dictionary<string, object> { { "key", "value" } });
_logger.BeginScope("some scope");
return View();
} The scope data such as key/value and "some scope" are lost, since they are not Related to this issue is how the data is serialized: runtime/src/libraries/Microsoft.Extensions.Logging.EventSource/src/EventSourceLogger.cs Lines 217 to 222 in 6072e4d
Json supports more than just strings, but all the data becomes string values after serialization. Please let me know if you need any more info. |
EventSourceLogger only sends IReadOnlyList<KeyValuePair<string, object>> state objects as part of the ActivityStart payload. This means calls like:
logger.BeginScope("string scope")
logger.BeginScope(new Dictionary<string, object>{"key", "value"}
do not contain any payload when listening to ActivityStart events.
The text was updated successfully, but these errors were encountered: