New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App Insights Tags for Orchestrators and Entities #1301
Conversation
I had the same question about adding this information before or after the actual function execution. I think the right way to go is to do this at the end of the execute method so that we have the right status value. BTW, were you able to verify that this data gets correctly populated in App Insights? It would be great if you could provide some screenshots in your PR description showing what this looks like. |
Now that I see the context where the information shows up, I think including the entire For example activity.AddTag("DurableEntityStatus", this.context.State.EntityExists ? $"has state ({this.context.State.EntityState.Length} characters)" : "no state"); As noted by others this should be done at the end of the operation to make sense (so it displays the final state, not the state before the operation). |
I'm open to suggestions about the prefix. However it feels like things that are the same between orchestrations and entities (like instance id) should share the same key. As for what we output as statuses for entities, outputting nothing is an option as well. We can always add later. The goal of this is to be able to list a summary of the last x orchestrations or entities that ran. Someone can click on a single instance id and the portal will render more details from the Should |
Maybe we should also match the naming convention to those we use already here: https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-diagnostics#single-instance-query e.g., |
src/WebJobs.Extensions.DurableTask/Listener/TaskOrchestrationShim.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments.
It looks like the App Veyor build failed because the C# compiler issued a warning when compiling against the .NET Framework (i.e. Functions v1). Basically, to the compiler it looks like you created a variable and assigned a value but never used it (we only use it for .NET Standard/Functions v2). A couple possible solutions:
I'm personally fine with either of these options. I'm open to other ideas as well. |
@cgillum , Yup! I finally figured out how to run the AppVeyor style cop on locally on Visual Studio, so those surprises should not be happening anymore. Fixed it using your first suggestion |
Summary of the latest changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for the most part. There is a lot of conditional compilation that I think we could probably reduce to make this much easier to read.
src/WebJobs.Extensions.DurableTask/Listener/TaskOrchestrationShim.cs
Outdated
Show resolved
Hide resolved
…e-extension into djusto/appInsights
Pushing this to our next release. |
src/WebJobs.Extensions.DurableTask/Listener/TaskOrchestrationShim.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
This addresses: #1172
This PR aims to add custom App Insights dimensions to enable querying recent orchestrators and entity calls.
For Orchestrators, we add the following fields:
DurableFunctionsType
as "Orchestrator"DurableFunctionsInstanceID
DurableFunctionsStatus
For Entities, we add the following fields:
DurableFunctionsType
as "Entity". I believe this tag name is a confusing, I'm open to improvements. Overall, it was unclear to me if these tags should also be prefixed withDurableFunctions-
orDurableEntity
DurableEntityInstanceID
DurableEntityStatus
I added these tags at the beginning of the "execute" methods, but if mid-execution their state is changed, then maybe this is not a good idea. Please let me know what you think. Overall, the current approach is rather naive so I expect to iterate on this.
Also, I realize that
DurableEntityStatus
returns a string-version of what are really JSON-codified fields. I'd be happy to expand those into proper tags as well.Update 1:
Below is a screenshot of how the changes look for Entities. I'm keep the screenshot small as to avoid leaking any sensitive information. This is the counter entity from the precompiled samples.