0
votes

I have a straight-forward web app setup:

Frontend --> APIM --> Azure Function --> Cosmos DB

I wanted to monitor this setup with Applications Insights so I configured everything with out-of-the-box setups:

  1. Created a vanilla Application Insights instance
  2. In the Azure Function App, I selected this AI resource and did not add any additional code to the function for custom telemetry data
  3. In the APIM instance, I selected the AI resource and did not apply any additional configuration
  4. In my javascript-based frontend, I added an AI instrumentation library to send telemetry data

After looking at the telemetry data, all the critical pieces appear to be transmitting correctly. However, the Application Map view is not properly representing the topology (names changed to be more clear):

enter image description here

There is no connection between Frontend --> APIM and no connection between APIM --> Azure Function.

Is there more configuration that is needed to make the tie?

1
Did you setup diagnostic settings on API or All APIs in APIM? - Vitaliy Kurokhtin

1 Answers

0
votes

There are 2 parts of the problem:

  • To show the proper correlation (for example, connection between frontend and APIM), you need to ensure standard correlation header is set in the http request when you call APIM APIs from your frontend application. For details, refer Telemetry correlation in Application Insights. In gist, set the traceparent (latest W3C standard) header with some unique id as mentioned here every time you make call to APIM exposed APIs. Once you do that, rest of the flow will respect that when dumping any telemetry in Application Insights automatically.
  • The problem in APIM side is you might have only added the App Insights in the APIM resource, but did not enable that for the API like below in the settings. Also, take a note of the 'Correlation protocol' should be 'W3C'. For details, refer How to integrate Azure API Management with Azure Application Insights. enter image description here

After this point, APIM will automatically set the correlation header while calling your backend Function and the inbuilt automatic telemetry collection will take care of the correlation.