您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

什么是 Application Insights?What is Application Insights?

Application Insights 是多个平台上面向 Web 开发人员的可扩展应用程序性能管理 (APM) 服务。Application Insights is an extensible Application Performance Management (APM) service for web developers on multiple platforms. 使用它可以监视实时 Web 应用程序。Use it to monitor your live web application. 它会自动检测性能异常。It will automatically detect performance anomalies. 其中包含强大的分析工具来帮助诊断问题,了解用户在应用中实际执行了哪些操作。It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app. 它旨在帮助持续提高性能与可用性。It's designed to help you continuously improve performance and usability. 它适用于本地云、混合云或任何公有云中托管的各种平台(包括 .NET、Node.js 和 Java EE)中的应用。It works for apps on a wide variety of platforms including .NET, Node.js and Java EE, hosted on-premises, hybrid, or any public cloud. 它与 DevOps 进程集成,并且具有与不同开发工具的连接点。It integrates with your DevOps process, and has connection points to a variety of development tools. 可以通过与 Visual Studio App Center 集成来监视和分析移动应用的遥测数据。It can monitor and analyze telemetry from mobile apps by integrating with Visual Studio App Center.

Application Insights 的工作原理是什么?How does Application Insights work?

在应用程序中安装小检测包,并在 Microsoft Azure 门户中设置 Application Insights 资源。You install a small instrumentation package in your application, and set up an Application Insights resource in the Microsoft Azure portal. 检测会监视应用,并将遥测数据发送到门户。The instrumentation monitors your app and sends telemetry data to the portal. (可在任意位置运行此应用程序 - 无需在 Azure 中托管。)(The application can run anywhere - it doesn't have to be hosted in Azure.)

不仅可以检测 Web 服务应用程序,还可以检测所有后台组件以及 Web 页面中的 JavaScript。You can instrument not only the web service application, but also any background components, and the JavaScript in the web pages themselves.

应用中的 Application Insights 检测将遥测发送到 Application Insights 资源。

此外,还可以从主机环境(如性能计数器、Azure 诊断或 Docker 日志)中拉取遥测。In addition, you can pull in telemetry from the host environments such as performance counters, Azure diagnostics, or Docker logs. 还可以对定期向 Web 服务发送综合请求的 Web 测试进行设置。You can also set up web tests that periodically send synthetic requests to your web service.

所有这些遥测流都在 Azure 门户中集成,可以在其中对原始数据应用强大的分析和搜索工具。All these telemetry streams are integrated in the Azure portal, where you can apply powerful analytic and search tools to the raw data.

什么是开销?What's the overhead?

应用性能受到的影响非常小。The impact on your app's performance is very small. 跟踪调用是非阻塞式的,以批量方式进行并在单独的线程中发送。Tracking calls are non-blocking, and are batched and sent in a separate thread.

Application Insights 监视器的工作原理是什么?What does Application Insights monitor?

Application Insights 主要面向开发团队,旨在帮助用户了解应用的运行性能和使用方式。Application Insights is aimed at the development team, to help you understand how your app is performing and how it's being used. 监视:It monitors:

  • 请求率、响应时间和失败率 - 了解最受欢迎的页面、时段以及用户的位置。Request rates, response times, and failure rates - Find out which pages are most popular, at what times of day, and where your users are. 查看哪些页面效果最好。See which pages perform best. 当有较多请求时,如果响应时间长且失败率高,则可能存在资源问题。If your response times and failure rates go high when there are more requests, then perhaps you have a resourcing problem.
  • 依赖项速率、响应时间和失败率 - 了解外部服务是否正拖慢速度。Dependency rates, response times, and failure rates - Find out whether external services are slowing you down.
  • 异常 - 分析聚合的统计信息,或选择特定实例并钻取堆栈跟踪和相关请求。Exceptions - Analyze the aggregated statistics, or pick specific instances and drill into the stack trace and related requests. 报告服务器和浏览器异常。Both server and browser exceptions are reported.
  • 页面查看次数和负载性能 - 由用户的浏览器报告。Page views and load performance - reported by your users' browsers.
  • AJAX 调用(从网页) - 速率、响应时间和失败率。AJAX calls from web pages - rates, response times, and failure rates.
  • 用户和会话计数User and session counts.
  • Windows 或 Linux 服务器计算机中的性能计数器,例如 CPU、内存和网络使用情况。Performance counters from your Windows or Linux server machines, such as CPU, memory, and network usage.
  • Docker 或 Azure 中的主机诊断Host diagnostics from Docker or Azure.
  • 应用中的诊断跟踪日志- 可以将跟踪事件与请求相关联。Diagnostic trace logs from your app - so that you can correlate trace events with requests.
  • 在客户端或服务器代码中自行编写的自定义事件和指标,用于跟踪业务事件(例如销售的商品或赢得的游戏)。Custom events and metrics that you write yourself in the client or server code, to track business events such as items sold or games won.

在哪里可以查看我的遥测数据?Where do I see my telemetry?

可通过许多方式浏览数据。There are plenty of ways to explore your data. 请查看以下文章:Check out these articles:

智能检测和手动警报Smart detection and manual alerts
当某些内容处于异常模式时,自动警报适应应用的遥测和触发器正常模式。Automatic alerts adapt to your app's normal patterns of telemetry and trigger when there's something outside the usual pattern. 还可以在自定义或标准指标的特定级别上设置警报You can also set alerts on particular levels of custom or standard metrics.
警报示例
应用程序映射Application map
应用的组件,包含关键指标和警报。The components of your app, with key metrics and alerts.
应用程序映射
探查器Profiler
检查抽样请求的执行配置文件。Inspect the execution profiles of sampled requests.
探查器
使用情况分析Usage analysis
分析用户细分和保留情况。Analyze user segmentation and retention.
留存情况工具
实例数据的诊断搜索Diagnostic search for instance data
搜索和筛选事件,例如请求、异常、依赖项调用、日志跟踪和页面视图。Search and filter events such as requests, exceptions, dependency calls, log traces, and page views.
搜索遥测
聚合数据的指标资源管理器Metrics Explorer for aggregated data
浏览、筛选和细分聚合的数据,例如请求率、故障率和异常率;响应时间、页面加载时间。Explore, filter, and segment aggregated data such as rates of requests, failures, and exceptions; response times, page load times.
度量值
仪表板Dashboards
混合使用来自多个资源的数据并与他人共享。Mash up data from multiple resources and share with others. 对于多组件应用程序和在团队聊天室中连续显示很有用。Great for multi-component applications, and for continuous display in the team room.
仪表板示例
实时指标流Live Metrics Stream
部署新的生成时,观看这些准实时性能指示器,确保一切按预期工作。When you deploy a new build, watch these near-real-time performance indicators to make sure everything works as expected.
实时指标示例
分析Analytics
使用此功能强大的查询语言,回答有关应用的性能和使用情况的疑难问题。Answer tough questions about your app's performance and usage by using this powerful query language.
分析示例
Visual StudioVisual Studio
查看代码中的性能数据。See performance data in the code. 从堆栈跟踪转到代码。Go to code from stack traces.
Visual Studio
快照调试器Snapshot debugger
使用参数值调试从实时操作采样的快照。Debug snapshots sampled from live operations, with parameter values.
Visual Studio
Power BIPower BI
将使用指标与其他商业智能集成。Integrate usage metrics with other business intelligence.
Power BI
REST APIREST API
编写代码以对指标和原始数据运行查询。Write code to run queries over your metrics and raw data.
REST API
连续导出Continuous export
原始数据到达后,立即将其批量导出到存储。Bulk export of raw data to storage as soon as it arrives.
导出

如何使用 Application Insights?How do I use Application Insights?

监视Monitor

在应用中安装 Application Insights,设置可用性 Web 测试,然后:Install Application Insights in your app, set up availability web tests, and:

  • 为团队聊天室签出默认应用程序仪表板,以便监视负载、响应能力和依赖项性能、页面加载和 AJAX 调用。Check-out the default application dashboard for your team room to keep an eye on load, responsiveness, and the performance of your dependencies, page loads, and AJAX calls.
  • 发现最慢和多数情况下失败的请求。Discover which are the slowest and most failing requests.
  • 在部署新版本时查看实时流,快速掌握任何降级情况。Watch Live Stream when you deploy a new release, to know immediately about any degradation.

检测、诊断Detect, Diagnose

当收到警报,或发现问题时:When you receive an alert or discover a problem:

  • 评估受到影响的的用户的数量。Assess how many users are affected.
  • 将失败与异常、依赖项调用和跟踪关联起来。Correlate failures with exceptions, dependency calls, and traces.
  • 检查探查器、快照、堆栈转储和跟踪日志。Examine profiler, snapshots, stack dumps, and trace logs.

生成、衡量、学习Build, Measure, Learn

测量有效性(针对部署的每个新功能)。Measure the effectiveness of each new feature that you deploy.

  • 规划以衡量客户使用新的 UX 或业务功能的方式。Plan to measure how customers use new UX or business features.
  • 将自定义遥测写入代码。Write custom telemetry into your code.
  • 使下一个开发周期基于遥测的硬性证据。Base the next development cycle on hard evidence from your telemetry.

入门Get started

Application Insights 是 Microsoft Azure 中托管的众多服务之一,遥测会发送到此处进行分析和展示。Application Insights is one of the many services hosted within Microsoft Azure, and telemetry is sent there for analysis and presentation. 因此在执行任何其他操作之前,需要有 Microsoft Azure 订阅。So before you do anything else, you'll need a subscription to Microsoft Azure. 可免费注册该订阅,如果选择 Application Insights 的基本pricing plan(定价计划),不会产生费用,但如果应用的使用量大幅增加,会产生费用。It's free to sign up, and if you choose the basic pricing plan of Application Insights, there's no charge until your application has grown to have substantial usage. 如果组织已有订阅,则组织可向其中添加 Microsoft 帐户。If your organization already has a subscription, they could add your Microsoft account to it.

可通过多种方法开始使用。There are several ways to get started. 可从最适合方法开始。Begin with whichever works best for you. 可在以后添加其他方法。You can add the others later.

后续步骤Next steps

在运行时开始使用:Get started at runtime with:

在开发时开始使用:Get started at development time with:

支持和反馈Support and feedback

视频Videos