maxAjaxCallsPerView doesn't account for filtering by TelemetryInitializer
See original GitHub issueIs 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:
- Created a year ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
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.
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.