Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function ExecutionContext.InvocationId vs FunctionFilterContext.FunctionInstanceId

ExecutionContext.InvocationId vs FunctionFilterContext.FunctionInstanceId

The ExecutionContext in Azure Function has a property InvocationId. In IFunctionInvocationFilter.OnExecutedAsync(FunctionExecutedContext ...) the FunctionExecutedContext has a property FunctionInstanceId, which is defined in its base class FunctionFilterContext.

  • In the same call, are these two Ids the same?
  • Are they unique for each call, or for each function instance?

Thanks if anyone can help!

like image 675
Stephen Zeng Avatar asked Sep 14 '25 23:09

Stephen Zeng


1 Answers

I was confused at first, but these are actually the same thing. They are both showing a unique identifier of function call, so they are the same for the same call, and different between calls.

The docs aren't great in this part, but you can compare Retrieving information about the currently running function

Provides the invocation ID, uniquely identifying the current invocation

with FunctionExceptionContext source code

The instance ID for the function invocation

I actually ran a test and both properties gave me the same Guid.

like image 51
Mikhail Shilkov Avatar answered Sep 17 '25 13:09

Mikhail Shilkov