Skip to content

Add instance id to logging scopes #250

@nilsmehlhorn

Description

@nilsmehlhorn

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:

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.

Metadata

Metadata

Labels

ObservabilityTrouble seeing app health or how functions run.P3

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions