-
Notifications
You must be signed in to change notification settings - Fork 26
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
ASP.NET CORE API running on ServiceFabric does not have service annotations when remoting #117
Comments
@AlkisFortuneFish did you add |
Yes, as is visible in the initialisation code I pasted above. The example cannot be copied directly because it uses TelemetryConfiguration.Active, which is deprecated, hence the explicit initialisation of the telemetry configuration. |
Originally I had the OperationCorrelationTelemetryInitializer there too, and it does appear to have been lost in the "throwing things at the wall to see what sticks" phase of trying to fix this. I've just re-added it to see if it makes any difference to the outcome, from memory, the issue was there with that too. |
If the 2 modules has been added to all services, then I can't think of why it doesn't work for you. |
Looking at the data here, I'm a bit confused:
So it would appear that the backend call is correctly annotated with an operation_ParentId that matches the remoting call that triggerred it but it has an entirely separate operation_Id. What could cause that? |
The telemetry operationId definitely needs to be the same for correlation. |
The initialisation I pasted above is from one of the ActorServices. All services have the initialisation I pasted above (which I updated just now). I am not sure what trickiness you are referring to, as far as I can see it is the same as initialisation of any other non-ASP.NET SF service, we already have explicitly derived ActorService classes for all our actor services for other reasons anyway. I am not sure why you keep pasting the example, I have seen the example, that is where I based my integration on, which you can clearly see if you read the code I pasted above. |
The trickiness for Actor is that you need to initialize the code in ActorBackendService, not in Program.cs or ActorBackend.cs. If you are already doing this and didn't touch any |
Yeah, we're not touching System.Diagnostics.Activity anywhere as far as I can see. We need this sorted however, so what are the next steps to debug it? I have been directed here from a support ticket, so I'm not sure where I could take it from here otherwise. |
Now I've had a bit of time allocated to look into this and managed to make the remote debugger work for the first time ever (why on earth is it considered acceptable not to be able to debug if you have multiple instances of the same SF application on the cluster and to silently fail if you do try!?), I have some findings. The activity Id is correctly passed from caller to receiver, the ParentId is deserialised and set. I am not hugely familiar with the overall pipeline, so any guidance as to what to look at in particular? |
Poke. If you do not have the time to look into this let me know to re-engage with the support request and get some Microsoft resources that way, I just need to know. |
@AlkisFortuneFish so the |
Ok, I think I've got to the bottom of this. There are a few different issues here, which is what made this difficult to track down.
So the fundamental issue is that this package, documentation, and examples are due an update to actually work with the latest ApplicationInsights package and .Net Core. I will update our integration to force the old format but I do not know if there are any plans to drop support for Hierarchical at some point, breaking the integration again in future. |
I'm glad that you found where it went wrong and get it fixed. Anyways, this project is in maintenance mode, if the old format is a real problem and will be dropped someday, then this library won't work. |
I'd have hoped that it's gracefully handled, as the documentation would suggest, but it does not appear to be entirely the case, if the Id format is W3C and the incoming Id is not, StartOperation in 2.17.0 generates a new Id instead of propagating what was passed in. |
We are running a couple of Service Fabric clusters on Azure VMSS, have integrated Application Insights instrumentation for performance data and have run into a technical issue with our integration. The APIs for our applications are implemented as ASP.NET CORE APIs served by Kestrel. They then make backend calls to the other microservices on the Service Fabric application using SF service remoting.
We integrated both the Application Insights .Net SDK and the Application Insights ServiceFabric SDK and they initialise correctly. However, we are ending up with a problem. While calls to the API are annotated correctly as coming from the ServiceFabric application on the correct nodes and everything, the Service Fabric remoting calls that occur on the API are detected as entirely separate calls and are not annotated correctly, so they appear to be coming from the default source named after the AppInsights instance.
Moreover, remoting calls seem to be correctly annotated with the target service but they do not resolve to the actual service on the Application Map, so they are not tracked past the actual remoting call itself. For example, if there is a call to to an API that makes a remoting call to service A, which calls service B, which calls service A, it looks like:
ApplicationInsightsInstance (missing the service and application annotation) -> A Remoting
A -> B Remoting
B -> A Remoting
A
Initialisation is done as follows:
In the service constructors:
In the ASP.NET Core services:
In the constructor:
Further initialisation happens in ConfigureServices:
These evolved multiple times before they ended up as they are, as I have been chasing this issue for a while and I have left out some details that I feel are not relevant (such as configuration actually being done by methods that are also called by the configuration package changed event etc.). I was directed to submit an issue here by the AppInsights support team.
I can point at the relevant resource and provide any more information as needed.
The text was updated successfully, but these errors were encountered: