【问题标题】:"Dependency (AJAX)" in Application InsightsApplication Insights 中的“依赖项 (AJAX)”
【发布时间】:2016-02-25 00:14:08
【问题描述】:

我们记录的大约 50% 的数据点是“依赖关系 (AJAX)”。

这是从哪里来的?

我认为这些“依赖项 (AJAX)”是在我的 Web 应用程序的应用程序设置中启用 Web 套接字后开始出现的(我们正在使用信号器)。

这些数据点的属性“Command”的值为“/signalr/ping”,所以这肯定与signalr有关。

我想排除这些,因为它使用了太多我的免费计划可用数据点。

Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule 已在我的 ApplicationInsights.config 中禁用。

编辑

我尝试禁用 Web 套接字,但仍然收到这些日志。

编辑 2016-02-24

按照 Alex 的建议,我设置了 disableAjaxTracking:true,但没有帮助。

这是我的 html 的 <head> 中的 appInsights 代码。

<script type="text/javascript">
    var appInsights = window.appInsights || function (config) {
        function r(config) { t[config] = function () { var i = arguments; t.queue.push(function () { t[config].apply(t, i) }) } } var t = { config: config }, u = document, e = window, o = "script", s = u.createElement(o), i, f; for (s.src = config.url || "//az416426.vo.msecnd.net/scripts/a/ai.0.js", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = ["Event", "Exception", "Metric", "PageView", "Trace"]; i.length;) r("track" + i.pop()); return r("setAuthenticatedUserContext"), r("clearAuthenticatedUserContext"), config.disableExceptionTracking || (i = "onerror", r("_" + i), f = e[i], e[i] = function (config, r, u, e, o) { var s = f && f(config, r, u, e, o); return s !== !0 && t["_" + i](config, r, u, e, o), s }), t
    }({
        instrumentationKey: "@Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey",
        disableAjaxTracking: true
    });
    window.appInsights = appInsights;
    appInsights.trackPageView();
</script>
@if (Request.IsAuthenticated)
{
    <script>
        appInsights.setAuthenticatedUserContext("@User.Identity.Name".replace(/[,;=| ]+/g, "_"));
    </script>
}

【问题讨论】:

  • 我们目前在这里遇到了同样的问题,由于 SignalR 的 ping 生成了 530 万个依赖数据点,因此破坏了免费层。如果我在我的网站上发现了什么,我会及时通知你。

标签: azure-application-insights


【解决方案1】:

从 2015 年 12 月开始,Application Insights JavaScript SDK 将自动收集 AJAX 请求。这是blog post about it。 由于它的启用,我们还引入了每个页面视图可以记录的 AJAX 请求的最大上限,默认值为 500,但您可以通过将此属性添加到您的 sn-p 来更改此设置(有关此内容的更多信息,请参阅博客和链接文档):

maxAjaxCallsPerView: <number>

您还可以使用此设置来完全禁用 AJAX 请求收集:

disableAjaxTracking: true

编辑:从 2016 年 2 月 24 日起,disableAjaxTracking 似乎已损坏,在修复之前,缓解措施是使用

maxAjaxCallsPerView: 0

【讨论】:

  • 我尝试设置 disableAjaxTracking:true,但仍然看到所有那些“依赖 (AJAX)”
  • 您的网站是否有面向公众的 URL,因此我们可以尝试诊断 Ajax 是否仍在收集?
  • 不抱歉,该站点需要身份验证,并且登录页面没有 appInsights 集成。如果有帮助,我确实使用 javascript appInsights 代码更新了我的问题。
  • 我想确认一下,远程依赖项确实是从您的浏览器发送的。您能否使用 F12 或 Fiddler 等浏览器工具来捕获发送到 dc.services.visualstudio.com 的网络负载并确保该有效负载中确实存在远程依赖项。例如,这是我从一个向 AI 发送 ajax 的网站截取的截图:ovjwdq.dm2303.df.livefilestore.com/…
  • 是的,我可以看到正在向 dc.services.visualstudio.com 发送 POST,其中包含许多“RemoteDependencyData”
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-16
  • 1970-01-01
  • 1970-01-01
  • 2017-06-28
相关资源
最近更新 更多