microsoft / durabletask-java

Java SDK for Durable Functions and the Durable Task Framework
MIT License
13 stars 7 forks source link

Enhanced capabilities for Azure Monitor metrics for functions #172

Open kanupriya15025 opened 8 months ago

kanupriya15025 commented 8 months ago

Today, durable framework provides good metrics to see the load on the clusters on Azure Monitor. Eg. how many instances for a specific function are in failed/successful state. But sometimes we need more than just these counts. Eg, each of these functions are triggered with some context, like this for triggered for which clientId, orgId etc. Now, these can be tags for the uber level failed/successful orchestrator/activity function.

I wanted to check if such an enhancement request could be catered to. I could think of a way like this :

@FunctionName("WorkflowOrchestrator")
@Labels [(clientId = ""), (technicalAccountId = ""), (orgId = "")]
public ObjectNode workflowOrchestrator(@DurableOrchestrationTrigger(name = "runtimeState") TaskOrchestrationContext ctx)

We could have a Labels annotation with a list of custom tags that could be added at the time of calling the function or be as a part of the context. And these could then be propagated as tags on Azure Monitor.

cgillum commented 8 months ago

The underlying Durable Task Framework and the Azure Storage backend do both support custom "tags" for orchestrations today. We haven't yet done the work to expose this feature to Durable Functions yet, or to all the storage backends. I think this is a good thing for us to consider though, and it makes sense to consider including custom tags in the telemetry that gets published to Azure Monitor / Application Insights.