azure-functions-host icon indicating copy to clipboard operation
azure-functions-host copied to clipboard

Application Insights Distributed Tracing for Queue Messages

Open plamber opened this issue 3 years ago • 7 comments

Is your question related to a specific version? If so, please specify:

Azure.Function.Extension 1.1.0 Microsoft.NET.SDK.Functions 4.0.1 C#

Question

We have some Azure Functions using Queue triggers. In some situations these functions are linked with each other. I would like to link the activities of these functions using Application Insights distributed tracing. Unfortunately, I haven't found the way to do this on the official documentation or in the existing issues.

I tried to use the Activity.Current.SetParent method. But this one cannot be used to link activities if the application insights activity already started.

Do you have some suggestions how I could achieve this goal? Is there some code that I could overwrite with dependency injection?

Thank you for your help, Patrick

plamber avatar Feb 21 '22 07:02 plamber

Thank you for the feedback, We will discuss this issue internally and let you know about the findings.

Ved2806 avatar Feb 22 '22 14:02 Ved2806

Hi @brettsam Do we have any documentation related to this issue for guidance?

Ved2806 avatar Feb 24 '22 09:02 Ved2806

Hi @plamber , Please refer this document for more information. Please let us know if this is useful. Thanks.

Ved2806 avatar Feb 24 '22 09:02 Ved2806

Hi @Ved2806, thank you for the link. Does it mean that the only way to achieve this is by creating new activities every time?

Thank you, Patrick

plamber avatar Feb 24 '22 12:02 plamber

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

ghost avatar Feb 28 '22 13:02 ghost

Hi @plamber Do you still have this issue?

Ved2806 avatar Aug 11 '22 14:08 Ved2806

Hi @Ved2806, I haven't touched on this topic since then. I still need to figure out an elegant way to avoid code repetitions in the functions.

Cheers

plamber avatar Aug 11 '22 14:08 plamber

Hi @kshyju Could you please help with this issue? or please suggest whom to tag here. Thanks.

Ved2806 avatar Aug 16 '22 12:08 Ved2806

Hi @RohitRanjanMS @brettsam could you please help with this issue?

Ved2806 avatar Oct 04 '22 13:10 Ved2806

Hi @plamber Storage queue does not support context propagation. If you have the traceparent, you can start a new Activity by passing ActivityContext. This will start a new activity and set the right parent. If you happen to use other triggers like service bus and event hub, there's inbuilt support of context propagation.

RohitRanjanMS avatar Oct 04 '22 20:10 RohitRanjanMS

Thank you all for the feedback. I am going to close this issue

plamber avatar Oct 05 '22 03:10 plamber