question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Persist ILogger scope for Distributed Tracing feature

See original GitHub issue

Hi,

When I create a ILogger Scope in my method with a DurableOrchestrationContext, activities called does not log the scope. I understand why but I am wondering if anything can be done about it, so that the scope is automagically included and is logged when I am in the activity.

using (logger.BeginScope("{SomeId}", someID)
{
    var returnValue = await context.CallActivityAsync<MyObject>("MapCartToMyObject", rawDataForProcessing);
}
...

[FunctionName("MapCartToMyObject")]
public static async Task<string> MapCartToMyObjectAsync([ActivityTrigger] DurableActivityContext inputs, ILogger log)
{
    var rawData = inputs.GetInput<string>();
    log.LogInformation("In {FunctionName}, some logging text: {RawData}", "MapCartToMyObjectAsync", rawData);
}
...

If not, are there any reccomendations, like “pass the logger in as a parameter” etc?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ThomasCronholmcommented, Oct 10, 2018

Well the idea for us, is to have a mechanism for storing correlation id’s so that we easlily can follow a durable execution through all logging we do using one id. Letting replay run as usual is not a problem as the thought of scope is to only couple different log entries together. GetStatusAsync with history is great and we love it, but when looking at logs there is a need to follow the thread, and as far as I have found getting the status with history is not easy from Application Insights. (sorry if I am rambling a bit)

0reactions
adstepcommented, Mar 18, 2021

I’m interested in a feature like this. This would make it a lot easier to pass around state to keep with the logs. @cgillum it looks like the end-to-end correlation feature has landed, but this didn’t make it in with it.

I can see a section related to this in the limitations of the correlation-csharp documentation. It seems like a PR that was blocking support for this has been merged. Is this something that can be reconsidered for support?

The custom property is available for ActivityTrigger once this pull request is accepted and a change added to the Durable Functions side. Track original activity at the Application Insights Logger

Read more comments on GitHub >

github_iconTop Results From Across the Web

ILogger.BeginScope(): persisting scope between calls to ...
My issue is that I need to call other methods in other classes, and I'm injecting the ILogger into all my classes. So...
Read more >
Logging in .NET Core and ASP.NET Core
In this article. Automatically log scope with SpanId, TraceId, ParentId, Baggage, and Tags.
Read more >
Distributed Logging and Tracing with Spring Boot 3 and ...
Distributed tracing enables developers and operations teams to track requests as they move across multiple services, providing insight into the ...
Read more >
Tracing with Spring Boot, OpenTelemetry, and Jaeger
A guide on how to set up your Spring Boot applications to emit traces and analyze them with Jaeger.
Read more >
Distributed Tracing for Functions
The distributed tracing feature observes the function's execution as it moves through the different components of the system.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found