-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Monitoring our durable workflows would be a lot easier if we'd see the corresponding instance id within app logs from orchestrators and activities in Application Insights. Ideally, all loggers in those durable functions would automatically use a scope containing the instance id.
Right now, we'd have to create our own scope in each orchestrator and also pass the instance id to each activity in order to create another logging scope there since, from my tests, the logging scope does not extend to activity invocations.
I've also looked into a middleware-based approach, however, I wasn't able to resolve the instance id reliably from FunctionContext.
As a side note, there are at least three different ways to create a logger and things unfortunately keep on changing:
- Migrate .NET apps from the in-process model to the isolated worker model - Logging:
ILogger<T>via DI (for Activities only?) - Create your first Durable Function in C#:
FunctionContext.GetLoggerin Activity - Diagnostics in Durable Functions - App Logging:
FunctionContext.GetLogger/TaskOrchestrationContext.CreateReplaySafeLogger
If you'd ask me, I'd say that all functions should use the conventional ILogger<T> via DI which would automatically be replay safe in orchestrators with some kind of way to obtain a non-replay safe logger for debugging purposes. I get that there are probably technical constraints for how the logger API is built though.