深入浅出Application Insights.Watermark

  • 格式:pdf
  • 大小:3.25 MB
  • 文档页数:31

手动安装nuget包
China .NET Conf 2019
服务器安装Status Monitor (无代码方案)
China .NET Conf 2019
• Install-Module -Name Az.ApplicationMonitor
China .NET Conf 2019
Application Insights的使用
China .NET Conf 2019
自定义开发
China .NET Conf 2019
• Application Insights提供开发者平台可以使得我们有机会利 用Insights的数据做一些自定义的功能
Q&A
China .NET Conf 2019
成本优化
筛选
China .NET Conf 2019
采样
采样(Sample)
China .NET Conf 2019
• Application Insights的采样能提供在不显著影响统计结果的 前提下降低流量和数据成本的功能。
• 采样意味着在n条结果中保留一条数据
• 如20%的采样率则意味着每5条数据只保留1条,其余丢弃 • 采样除数n会在每个记录的属性itemCount中保留,如上文
China .NET Conf 2019
.NET Core 2019
Application Insights
演讲人:罗彬
什么是 Application Insights
China .NET Conf 2019
Application Insights会收集什么数据
• 请求/响应信息 • 依赖项(Sql,Http等) • 页面信息 • 用户信息 • 异常 • 服务器性能数据 • 其他自定义信息
China .NET Conf 2019
Application Insights的工作流
China .NET Conf 2019
Application Insights的费用
China .NET Conf 2019
如何引入Application Insights
China .NET Conf 2019
让我们来分析下
China .NET Conf 2019
• requests
• | where success != "True" and timestamp > ago(7d)
• | summarize count() by bin(timestamp, 1h) , name
• | render timechart
China .NET Conf 2019
手动安装nuget包
• 然后在你的项目里添加代码使用(.NET Core) • public void ConfigureServices (IServiceCollection services) •{ • // Other Code • services.AddApplicationInsightsTelemetry(“你的key”); •}
与其他系统的集成
China .NET Conf 2019
与Azure Devops集成 Grafana可视化展示
与Azure DevOps的集成
China .NET Conf 2019
安装插件
China .NET Conf 2019
创建Api密钥
China .NET Conf 2019
Azure DevOps发布流程配置
China .NET Conf 2019
最终成果
China .NET Conf 2019
Grafana展示
China .NET Conf 2019
Grafana插件安装

China .NET Conf 2019
添加数据源
China .NET Conf 2019
设置展示
China .NET Conf 2019
• 筛选需要编写代码实现
筛选的代码示例-仅记录失败的依赖项
China .NET Conf 2019
筛选的代码示例-仅记录失败的依赖项
• 然后在Startup里添加进去
public void ConfigureServices (IServiceCollection services) {
// ... services.AddApplicationInsightsTelemetry(); services.AddApplicationInsightsTelemetryProcessor<Suc cessfulDependencyFilter>(); }
通过VS引入
手动安装nuget包
服务器安装Status Monitor(无代码方案)
通过VS引入
China .NET Conf 2019
手动安装nuget包
• .Net Core项目安装 Microsoft.ApplicationInsig hts.AspNetCore
• .Net Framework项目安装 Microsoft.ApplicationInsig hts.Web
itemCount为5
• 根据itemCount可以大约反向推导原始的数据
如何设置采样
China .NET Conf 2019
筛选(Filter)
China .NET Conf 2019
• 筛选可以使我们显式控制包含或者排除流量中指定内容
• 筛选相对于采样效果更加直接但是会直接影响统计数据
• 建议仅在采样已经无法压制住费用的时候使用