We have 5 reliable actor services which are being called from a stateless aspnet core web api. Now, the service fabric application is running in production but as a part of migration to azure we want all our custom events and trace to app insight.
How can we add the same to SF? Please note that I am looking specifically for reliable actor service. It's kind of simple adding that in reliable service but I am facing challenges with Actor services.
I referred to this https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-monitoring-aspnet tutorial for reliable services but same doesn't work in case of reliable actor service written in .NET Framework.
Quoting the example from this open GitHub issue: Add documentation for configure actor services
Setting Service Context
Enabling Correlation for Service Remoting
Firstly, make sure Service Remoting is set up correctly. You can find more info here.
Remoting V2 (recommended)
Initialize the Service Remoting dependency/request tracking modules like below.
Note: You can also set the service context through the
CreateFabricTelemetryInitializer
method. In this case, you don't need to callSetServiceCallContext
Remoting V1
If you still want to use Service Remoting V1 and also track correlation, you can follow the instructions below, but it's strongly recommended that you upgrade to Remoting V2.
Originally posted by @yantang-msft in https://github.com/microsoft/ApplicationInsights-ServiceFabric/issue_comments/434430800
Other resources: service-fabric-application-insights-example