Small post on how to send correlation identifiers to the application monitored by Application Insights. It is a reflection on investigation what Application Insights Availability tests need to send to the application to natively correlate test execution identifier with the telemetry produced by that application.
Here is a small asp.net core test application I used. It writes in response request telemetry properties so can be easily used with
1 2 3 4 5 6 7
Http correlation protocol used by Application Insights is posted on GitHub. The good thing about this protocol is that it’s flexible and works with the most identity schemes you may have. If you want to correlate entire distributed transaction by the given identifier - the only thing you need to do is to send it as a
1 2 3 4 5 6
In the example above I formatted identifier as a GUID. For the real life implementation, I’d suggest formatting this GUID as a 16-bytes array in hex. Like
4bf92f3577b34da6a3ce929d0e0e4736. It will be consistent with the future direction on correlation protocol.
If one test sends multiple requests to one or many applications - you’d want to send a different id-s with every request. It’s easy to do. Just append to the test execution identity any random seed and sequence number of the request. In the example below seed is
sd and sequencing starts with
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
As I mentioned before for the better application map, you’d need to propagate an app-id of the calling component. First, having instrumentation key you can get app-id:
Then you can send app-id as a
1 2 3 4 5 6 7 8 9 10
This way you can identify two components to correlate telemetry.
RequestTelemetry’s source field points to the component that sent original request.
You can use this correlation technique when you run some synthetic traffic on your application or call it from some mobile application.