0

I implemented the application insights in my angular 2 application. In that I am tracking logged users, page views, custom events, exceptions and dependency calls.

When I observe the telemetry data in azure, it shows page views, events, exceptions, users and dependency Ajax calls. But the dependency Ajax calls will monitor node modules dependencies along with my Rest API calls what I wrote code in my application.

Please see the below image for more information about Ajax calls in node modules classes.

enter image description here

And also I am able to see the browserLinkSignalR dependency Ajax calls in azure application insights resource.

Please see the below image for more information about browserLinkSignalR Ajax calls.

enter image description here

This is the code I wrote in app.component.ts for initialization

 this._appInsightsService.Init({
       instrumentationKey: 'XXXXXXXXXXXXXXXXXXXXXXXX', // Required field
       // enableDebug: false,
       maxAjaxCallsPerView: 50,
       //disableAjaxTracking: true
       //samplingPercentage:10,
       //disableTelemetry: true
    });

How can I monitor only code related dependencies Ajax calls not a node modules dependencies and browserLinkSignalR Ajax calls?

halfer
  • 19,824
  • 17
  • 99
  • 186
Pradeep
  • 5,101
  • 14
  • 68
  • 140

1 Answers1

1

in the normal javascript sdk, you'd write a telemetry processor/initializer and use that to filter out items that you don't want to send:

from: https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-filtering-sampling (and also https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md)

presuming angular should have similar ability?

appInsights.context.addTelemetryInitializer(function (envelope) {
        var telemetryItem = envelope.data.baseData;

        // check item properties, and return false to prevent this item from being sent
    });
John Gardner
  • 24,225
  • 5
  • 58
  • 76
  • Thanks, but I used typescript not an java script and also I don't want to send node_modules dependencies means remote dependencies. – Pradeep Feb 28 '17 at 06:49
  • which version of what angular package from where are you using? this was my point: in the standard javascript sdk, this is how you would write code to filter out dependencies. *some* of the angular sdks for application insights actually sit on top of the existing ai javascript sdk, so you'd just do it this way. but until i know what version of what angular thing you are using, i can't be more specific. – John Gardner Feb 28 '17 at 20:01
  • Thanks, I used angular 2 and typescript 2.0 version for writing the code. – Pradeep Mar 01 '17 at 04:20
  • no, i'm talking about the application insights things you're using. what *exactly* are you using, and from *where* ? because there are many different things that allow you to add appinsights to angular apps, and they all do things differently. – John Gardner Mar 01 '17 at 19:51
  • I used ng2-appinsights from this link https://github.com/harry671003/ng2-appinsights. – Pradeep Mar 02 '17 at 04:43
  • nt2-appinsights *appears* from my reading to just be sitting on top of the standard AI javascript sdk. they even have a link to the AI JS github at the bottom their readme.md on their github page. you should therefore be able to use something similar to what i've done above to inject a telemetry initializer to filter out things you don't want. – John Gardner Mar 03 '17 at 23:38