question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

maxAjaxCallsPerView doesn't account for filtering by TelemetryInitializer

See original GitHub issue

Is your feature request related to a problem? Please describe. I’m using a telemetry initializer to filter out a large volume of AJAX remote dependency calls that fit a particular criteria. Depending on user activity, there may be thousands of dependency calls that do not get logged.

The problem though, is that these filtered / excluded events still count towards the count of tracked AJAX attempts, which is limited per maxAjaxCallsPerView configuration parameter.

So, say there are 1,000 AJAX requests on the page. 980 of them get filtered by my telemetry initializer. The remaining 20 may not all get logged, because the 980 that were filtered out, all counted towards the default limit of 500, then I get error: “Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.”

Describe the solution you’d like AJAX remote dependancy calls that are filtered by a telemetry initializer should not count towards the maxAjaxCallsPerView.

Describe alternatives you’ve considered I can set maxAjaxCallsPerView to -1, so I do get all AJAX dependencies logged. I can then use the telemetry initializer to implement my own “max ajax calls per view” logic, so there’s no loss of functionality. It’s just: a) A bit of extra work, and; b) An unexpected outcome - it’s strange to have, say, only 20 AJAX dependencies logged, while simultaneously getting the error “Maximum ajax per page view limit reached”.

Additional context Refer: extensions\applicationinsights-dependencies-js\src\ajax.ts

_trackAjaxAttempts variable is checked, and incremented in this function.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MSNevcommented, Aug 30, 2022

Ok, I managed to sneak this into the next release (should start later this week) as it was around the same location as some other required changes.

I’ve added a addDependencyInitializer and included some documentation here.

All going well there should be an automated nightly deployment tonight with this change included that you should be able to test before the final release.

1reaction
MSNevcommented, Aug 18, 2022

That is not going to work as the TelemetryInitializer is further down the pipeline from the code that produces (or not produces) the dependency request.

What I think you are trying to do is just stop the request from being tracked, which there is a config for that is evaluated here the config is called excludeRequestFromAutoTrackingPatterns if can be an array of RegEx’s or strings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filtering and preprocessing in the Application Insights SDK
Write telemetry processors and telemetry initializers for the SDK to filter or add properties to the data before the telemetry is sent to ......
Read more >
microsoft/applicationinsights-analytics-js
... to drop the event the event does NOT count against the maxAjaxCallsPerView ... maxAjaxCallsPerView doesn't account for filtering by TelemetryInitializer.
Read more >
microsoft/applicationinsights-web
@param customProperties Additional data used to filter events and metrics. Defaults to empty. ... This method doesn't send any telemetry.
Read more >
Filter out signalr requests from Application Insights
Cannot validate right now, so will fix any syntax errors later: window.appInsights = appInsights; // Add telemetry initializer ...
Read more >
What are app insights? How to Add & Filter Available ...
Filter out telemetry data with Telemetry Processors ... This doesn't count login failures towards account lockout
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found