简体   繁体   English

是否使用Application Insights记录查看的列表项?

[英]Application Insights to log viewed list-items?

I need to create a record for every single content the users see on my system, so that later I can have some statistics/measures of what has been seen the most on the system. 我需要为用户在系统上看到的每个内容创建一个记录,以便以后我可以对系统上最常看到的内容进行一些统计/度量。

In order to do that, I'm considering using Application Insights via javascript. 为了做到这一点,我正在考虑通过javascript使用Application Insights。 But I got a few questions: 但是我有几个问题:

  • Do Application Insights allow us to make a possible big number of calls often? Application Insights是否允许我们经常拨打大量电话? (for every list-item that appears on the user screen as the screen is scrolled, I would make a call - and I could have many many users doing that at the same time) (对于在屏幕滚动时出现在用户屏幕上的每个列表项,我都会拨打电话-我可能有很多用户同时执行该操作)

  • If some error happens when trying to make a call to Application Insights at a certain moment, will it try to make the call again later? 如果在某个时刻尝试致电Application Insights时发生一些错误,它将在以后尝试再次致电吗? (in other words, is it safe to trust that after I make my call they'll take care of it and they'll try to do it again later in case we're having an internet problem at the moment, for example?) (换句话说,例如,可以放心,我打完电话后,他们会照顾好他们,等以后遇到互联网问题时,他们会再尝试一次吗?)

  • Is it rather a bad approach to use Application Insights for this purpose? 为此目的使用Application Insights是一种不好的方法吗? (I'm considering Application Insights also because it would reduce the number of calls to our database, and I don't need this data to be kept for a long time so the 3-months that we have with Application Insights would be enough) (我之所以考虑使用Application Insights,还因为它可以减少对数据库的调用次数,并且我不需要长时间保留这些数据,因此使用Application Insights的三个月就足够了)

What I mean by "calling Application Insights" is a simple ajax that would asynchronously request Application Insights to create a record that a list-item was viewed (I'd send each list-item ID along as they're viewed so we can identify and count the views each item had by the end of the day). 我所说的“调用应用程序见解”是一个简单的ajax,它将异步请求应用程序见解创建一条记录,其中记录了一个列表项(我会在查看每个列表项ID的同时发送它,以便我们可以识别并计算到一天结束时每个项目的观看次数)。

Anyone knows enough to help with these questions, maybe? 有人知道足以解决这些问题吗? =) =)

There are two ways to upload data to Application Insights from JavaScript: 有两种方法可以将数据从JavaScript上传到Application Insights:

  1. Using JS AI SDK and call trackEvent 使用JS AI SDK并调用trackEvent
  2. Calling AI ingestion point directly (Ajax) 直接调用AI提取点(Ajax)

Answering your questions for both approaches. 回答两种方法的问题。

JS AI SDK JS AI SDK

  1. It is okay to call trackEvent as often as possible. 可以尽可能频繁地调用trackEvent。 JS AI SDK will batch documents and will minimize the number of AJAX calls to AI ingestion endpoint JS AI SDK将批量处理文档,并将尽量减少对AI摄取端点的AJAX调用次数
  2. Successful trackEvent doesn't mean that data got uploaded. 成功的trackEvent并不意味着已上传数据。 There might be a few reasons why data will not be delivered: a) User closes browser right away; 可能无法传送数据的原因可能有几个:a)用户立即关闭浏览器; b) If there is no connection to AI ingestion endpoint. b)如果没有与AI摄取端点的连接。

Direct AJAX 直接AJAX

  1. It is okay to call AI ingestion endpoint as many times as needed 可以根据需要多次调用AI摄入端点
  2. 200 response code means that data got persisted and there is a guarantee that data will not be lost 200个响应代码表示数据已保留,并且可以保证数据不会丢失

Re: Is it rather a bad approach to use Application Insights for this purpose? 回复:为此目的使用Application Insights是一种不好的方法吗?

(disclosure: I'm associated with Application Insights team) (公开:我与Application Insights团队有联系)

If these events are business telemetry or logs important for audit then it fits into main scenarios of Application Insights. 如果这些事件是业务遥测或对审计很重要的日志,则它适合于Application Insights的主要场景。

If these events are more kind of debug/verbose level traces then though Application Insights still can be used here, you might want to double check that pricing is reasonable for the value. 如果这些事件是更多的调试/详细级别跟踪信息,则尽管仍可以在此处使用Application Insights,但您可能需要仔细检查价格是否合理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM