Web 应用程序上的分析
Analytics on a web application
我们有一个网络应用程序。 Web 应用程序的一部分是配置文件。配置文件具有以下 urls:
/Profile/1
/Profile/2
/Profile/3
我们也有添加。添加的url如下:
/Add/1
/Add/2
/Add/3
我需要查看查看次数最多的前 20 个个人资料和查看次数最多的前 20 个添加内容以及他们有多少查看次数。还必须可以使用 C# 提取这两个列表。这可以通过日志分析来实现吗?您是否需要自己从应用程序洞察力中提取所有内容并自己进行分析,或者您将如何实现这一目标?
我做了一点POC。我在 AI 中添加了以下内容。 https://gac/url/1 has thousands of id's. Maybe there us 244 views on https://gac/url/1 and 1128 views on https://gac/url/2and等等。
我注意到 Id 没有添加到日志中。请参阅下面的代码:
public void WritePageView(string name, string id, Uri url)
{
var pageView = new PageViewTelemetry
{
Name = name,
Id = id,
Url = url
};
pageView.Properties.Add("Id", "1");
telemetry.TrackPageView(pageView);
}
我需要的是前 20(top x),其中 https://gac/url 访问量最大。类似于:
https://gac/url1: 3434
https://gac/url1: 2432
https://gac/url1: 1298
https://gac/url1: 8211
..
如果显示在图表中将非常棒。
所以它类似于按名称和 ID 分组。但由于 Id 仅存在于 url 中,我该如何提取它?
使用分析查询获取应用程序见解很容易。
导航到您的 Azure 门户 -> 应用程序见解 -> 日志(分析),相关信息应该在 pageViews table 中。当您编写查询时,您可以通过 UI 或使用 where 子句设置自定义 "Time Range"。
只需写"pageViews"即可获取所有pageViews信息,截图如下:
并且您可以使用 Summarize operator and count operator 获取每个页面的总浏览量。示例查询代码如下:
pageViews
| summarize totalCount = count(url) by url
| order by totalCount desc
结果如下:
如果你只想获取前2个浏览量最高的页面,使用以下代码:
pageViews
| summarize totalCount = count(url) by url
| order by totalCount desc
| top 2 by totalCount
我们有一个网络应用程序。 Web 应用程序的一部分是配置文件。配置文件具有以下 urls:
/Profile/1 /Profile/2 /Profile/3
我们也有添加。添加的url如下: /Add/1 /Add/2 /Add/3
我需要查看查看次数最多的前 20 个个人资料和查看次数最多的前 20 个添加内容以及他们有多少查看次数。还必须可以使用 C# 提取这两个列表。这可以通过日志分析来实现吗?您是否需要自己从应用程序洞察力中提取所有内容并自己进行分析,或者您将如何实现这一目标?
我做了一点POC。我在 AI 中添加了以下内容。 https://gac/url/1 has thousands of id's. Maybe there us 244 views on https://gac/url/1 and 1128 views on https://gac/url/2and等等。
public void WritePageView(string name, string id, Uri url)
{
var pageView = new PageViewTelemetry
{
Name = name,
Id = id,
Url = url
};
pageView.Properties.Add("Id", "1");
telemetry.TrackPageView(pageView);
}
我需要的是前 20(top x),其中 https://gac/url 访问量最大。类似于:
https://gac/url1: 3434 https://gac/url1: 2432 https://gac/url1: 1298 https://gac/url1: 8211 .. 如果显示在图表中将非常棒。
所以它类似于按名称和 ID 分组。但由于 Id 仅存在于 url 中,我该如何提取它?
使用分析查询获取应用程序见解很容易。
导航到您的 Azure 门户 -> 应用程序见解 -> 日志(分析),相关信息应该在 pageViews table 中。当您编写查询时,您可以通过 UI 或使用 where 子句设置自定义 "Time Range"。
只需写"pageViews"即可获取所有pageViews信息,截图如下:
并且您可以使用 Summarize operator and count operator 获取每个页面的总浏览量。示例查询代码如下:
pageViews
| summarize totalCount = count(url) by url
| order by totalCount desc
结果如下:
如果你只想获取前2个浏览量最高的页面,使用以下代码:
pageViews
| summarize totalCount = count(url) by url
| order by totalCount desc
| top 2 by totalCount