Application Insights 连接器管理解决方案(已弃用)Application Insights Connector management solution (Deprecated)

Application Insights 符号

备注

跨资源查询的支持下,不再需要 Application Insights 连接器管理解决方案。With the support of cross-resource queries, the Application Insights Connector management solution is no longer required. 此解决方案已停用,并已从 Azure 市场中删除。It has been deprecated and removed from Azure Marketplace.

现有连接将继续运行到 2019 年 6 月 30 日为止。Existing connections will continue to work until June 30, 2019. 随着 OMS 门户被弃用,将无法从门户中配置和删除现有的连接。With OMS portal deprecation, there is no way to configure and remove existing connections from the portal. 有关使用 PowerShell 删除现有连接的脚本,请参阅下面的使用 PowerShell 删除连接器See Removing the connector with PowerShell below for a script on using PowerShell to remove existing connections.

有关查询多个应用程序的 Application Insights 日志数据的指导,请参阅统一多个 Azure Monitor Application Insights 资源For guidance on querying Application Insights log data for multiple applications, see Unify multiple Azure Monitor Application Insights resources.

可以借助 Application Insights 连接器解决方案诊断性能问题,以及了解用户在使用 Application Insights 监视的应用中执行的操作。The Applications Insights Connector solution helps you diagnose performance issues and understand what users do with your app when it is monitored with Application Insights. Log Analytics 中提供了 Application Insights 中向开发人员显示的相同应用程序遥测数据视图。Views of the same application telemetry that developers see in Application Insights are available in Log Analytics. 但是,将 Application Insights 应用与 Log Analytics 集成时,将操作和应用程序数据放在一个位置可以增强应用程序的可见性。However, when you integrate your Application Insights apps with Log Analytics, visibility of your applications is increased by having operation and application data in one place. 使用相同的视图有助于与应用开发人员协作。Having the same views helps you to collaborate with your app developers. 常见的视图可帮助减少检测和解决应用程序与平台问题的时间。The common views can help reduce the time to detect and resolve both application and platform issues.

使用该解决方案时,可以:When you use the solution, you can:

  • 在一个位置查看所有 Application Insights 应用,即使它们位于不同的 Azure 订阅中View all your Application Insights apps in a one place, even when they are in different Azure subscriptions
  • 将基础结构数据与应用程序数据相关联Correlate infrastructure data with application data
  • 在日志搜索中使用透视图可视化应用程序数据Visualize application data with perspectives in log search
  • 在 Log Analytics 和 Azure 门户中通过 Log Analytics 数据透视 Application Insights 应用Pivot from Log Analytics data to your Application Insights app in the Azure portal

备注

本文进行了更新,以便使用新的 Azure PowerShell Az 模块。This article has been updated to use the new Azure PowerShell Az module. 你仍然可以使用 AzureRM 模块,至少在 2020 年 12 月之前,它将继续接收 bug 修补程序。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要详细了解新的 Az 模块和 AzureRM 兼容性,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 有关 Az 模块安装说明,请参阅安装 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

连接的源Connected sources

与其他大多数 Log Analytics 解决方案不同,代理不会收集 Application Insights 连接器的数据。Unlike most other Log Analytics solutions, data isn't collected for the Application Insights Connector by agents. 该解决方案使用的全部数据都直接来自于 Azure。All data used by the solution comes directly from Azure.

连接的源Connected Source 支持Supported 说明Description
Windows 代理Windows agents No 解决方案不会从 Windows 代理收集信息。The solution does not collect information from Windows agents.
Linux 代理Linux agents No 解决方案不会从 Linux 代理收集信息。The solution does not collect information from Linux agents.
Azure 存储帐户Azure storage account No 该解决方案不会从 Azure 存储收集信息。The solution does not collection information from Azure storage.

先决条件Prerequisites

  • 若要访问 Application Insights 连接器信息,必须拥有 Azure 订阅To access Application Insights Connector information, you must have an Azure subscription
  • 必须至少配置了一个 Application Insights 资源。You must have at least one configured Application Insights resource.
  • 必须是 Application Insights 资源的所有者或参与者。You must be the owner or contributor of the Application Insights resource.

ConfigurationConfiguration

  1. Azure 市场或者使用从解决方案库中添加 Log Analytics 解决方案中所述的过程,启用 Azure Web 应用分析解决方案。Enable the Azure Web Apps Analytics solution from the Azure marketplace or by using the process described in Add Log Analytics solutions from the Solutions Gallery.
  2. 浏览到 Azure 门户Browse to the Azure portal. 选择“所有服务”以打开 Application Insights。Select All services to open Application Insights. 然后,搜索 Application Insights。Then, search for Application Insights.
  3. 在“订阅”下,选择包含 Application Insights 资源的订阅,然后在“名称”下选择一个或多个应用程序。Under Subscriptions, select a subscription that has Application Insights resources and then under Name, select one or more applications.
  4. 单击“ 保存”。Click Save.

大约 30 分钟后,数据将会可用,Application Insights 磁贴中会更新数据,如下图所示:In approximately 30 minutes, data becomes available and the Application Insights tile is updated with data, like the following image:

Application Insights 磁贴

要记住的其他要点:Other points to keep in mind:

管理包Management packs

此解决方案不会在连接的管理组中安装任何管理包。This solution does not install any management packs in connected management groups.

使用解决方案Use the solution

以下部分介绍了如何使用 Application Insights 仪表板中显示的边栏选项卡来查看应用中的数据并与其交互。The following sections describe how you can use the blades shown in the Application Insights dashboard to view and interact with data from your apps.

查看 Application Insights 连接器信息View Application Insights Connector information

单击“Application Insights”磁贴打开“Application Insights”仪表板查看以下边栏选项卡。Click the Application Insights tile to open the Application Insights dashboard to see the following blades.

Application Insights 仪表板的屏幕截图,其中显示“应用程序”、“数据量”和“可用性”的边栏选项卡。

Application Insights 仪表板的屏幕截图,其中显示“服务器请求”、“失败”和“异常”的边栏选项卡。

该仪表板包含下表中所示的边栏选项卡。The dashboard includes the blades shown in the table. 每个边栏选项卡按照指定范围和时间范围列出了匹配该边栏选项卡条件的最多 10 个项。Each blade lists up to 10 items matching that blade's criteria for the specified scope and time range. 单击边栏选项卡底部的“查看全部”或单击边栏选项卡标题时,可运行返回所有记录的日志搜索。You can run a log search that returns all records when you click See all at the bottom of the blade or when you click the blade header.

Column 说明Description
应用程序数 - 应用程序的数目Applications - Number of applications 显示应用程序资源中的应用程序数目。Shows the number of applications in Application resources. 此外,还会列出应用程序名称,以及每个应用程序名称的应用程序记录数。Also lists application names and for each, the count of application records. 单击数字可以针对 ApplicationInsights | summarize AggregatedValue = sum(SampledCount) by ApplicationName 运行日志搜索Click the number to run a log search for ApplicationInsights | summarize AggregatedValue = sum(SampledCount) by ApplicationName

单击应用程序名称可以针对该应用程序运行日志搜索,显示每台主机的应用程序记录、按遥测类型列出的记录,以及按类型列出的所有数据(基于前一天)。Click an application name to run a log search for the application that shows application records per host, records by telemetry type, and all data by type (based on the last day).
数据量 - 发送数据的主机数Data Volume - Hosts sending data 显示发送数据的计算机主机数。Shows the number of computer hosts that are sending data. 此外,还列出计算机主机数以及每台主机的记录数。Also lists computer hosts and record count for each host. 单击数字可以针对 ApplicationInsights | summarize AggregatedValue = sum(SampledCount) by Host 运行日志搜索Click the number to run a log search for ApplicationInsights | summarize AggregatedValue = sum(SampledCount) by Host

单击计算机名称可以针对该主机运行日志搜索,显示每台主机的应用程序记录、按遥测类型列出的记录,以及按类型列出的所有数据(基于前一天)。Click on a computer name to run a log search for the host that shows application records per host, records by telemetry type, and all data by type (based on the last day).
可用性 - Web 测试结果Availability - Webtest results 显示 Web 测试结果的圆环图,指示测试是通过还是失败。Shows a doughnut chart for web test results, indicating pass or fail. 单击该图表可以针对 ApplicationInsights | where TelemetryType == "Availability" | summarize AggregatedValue = sum(SampledCount) by AvailabilityResult 运行日志搜索Click the chart to run a log search for ApplicationInsights | where TelemetryType == "Availability" | summarize AggregatedValue = sum(SampledCount) by AvailabilityResult

结果显示所有测试的通过和失败结果数目。Results show the number of passes and failures for all tests. 它会显示最近一分钟产生了流量的所有 Web 应用。It shows all Web Apps with traffic for the last minute. 单击应用程序名称可以查看显示已失败 Web 测试详细信息的日志搜索。Click an application name to view a log search showing details of failed web tests.
服务器请求数 - 每小时请求数Server Requests - Requests per hour 显示各个应用程序每小时服务器请求数的折线图。Shows a line chart of the server requests per hour for various applications. 将鼠标悬停在图表中的某个线条上可以查看在特定的时间点,接收请求数最多的 3 个应用程序。Hover over a line in the chart to see the top 3 applications receiving requests for a point in time. 此外,还显示在选定时间段内,接收请求的应用程序列表以及请求数目。Also shows a list of the applications receiving requests and the number of requests for the selected period.

单击图形可以针对 ApplicationInsights | where TelemetryType == "Request" | summarize AggregatedValue = sum(SampledCount) by ApplicationName, bin(TimeGenerated, 1h) 运行日志搜索,显示各个应用程序每小时的服务器请求数的更详细折线图。Click the graph to run a log search for ApplicationInsights | where TelemetryType == "Request" | summarize AggregatedValue = sum(SampledCount) by ApplicationName, bin(TimeGenerated, 1h) that shows a more detailed line chart of the server requests per hour for various applications.

单击列表中的某个应用程序可以针对 ApplicationInsights | where ApplicationName == "yourapplicationname" and TelemetryType == "Request" and iff(isnotnull(toint(RequestSuccess)), RequestSuccess == false, RequestSuccess == "false") == true 运行日志搜索,显示请求列表、不同时间的请求数图表、请求持续时间以及请求响应代码列表。Click an application in the list to run a log search for ApplicationInsights | where ApplicationName == "yourapplicationname" and TelemetryType == "Request" and iff(isnotnull(toint(RequestSuccess)), RequestSuccess == false, RequestSuccess == "false") == true that shows a list of requests, charts for requests over time and request duration and a list of request response codes.
失败 - 每小时的失败请求数Failures - Failed requests per hour 显示每小时失败的应用程序请求数的折线图。Shows a line chart of failed application requests per hour. 将鼠标悬停在该图表上可以查看在特定的时间点请求失败次数最多的 3 个应用程序。Hover over the chart to see the top 3 applications with failed requests for a point in time. 此外,还显示应用程序列表以及每个应用程序的失败请求数目。Also shows a list of applications with the number of failed requests for each. 单击该图表可以针对 ApplicationInsights | where TelemetryType == "Request" and iff(isnotnull(toint(RequestSuccess)), RequestSuccess == false, RequestSuccess == "false") == true | summarize AggregatedValue = sum(SampledCount) by ApplicationName, bin(TimeGenerated, 1h) 运行日志搜索,显示失败应用程序请求数的更详细折线图。Click the chart to run a log search for ApplicationInsights | where TelemetryType == "Request" and iff(isnotnull(toint(RequestSuccess)), RequestSuccess == false, RequestSuccess == "false") == true | summarize AggregatedValue = sum(SampledCount) by ApplicationName, bin(TimeGenerated, 1h) that shows a more detailed line chart of failed application requests.

单击列表中的某个项可以针对 ApplicationInsights | where ApplicationName == "yourapplicationname" and TelemetryType == "Request" and iff(isnotnull(toint(RequestSuccess)), RequestSuccess == false, RequestSuccess == "false") == true 运行日志搜索,显示失败的请求数、不同时间的失败请求数图表、请求持续时间以及失败请求的响应代码列表。Click an item in the list to run a log search for ApplicationInsights | where ApplicationName == "yourapplicationname" and TelemetryType == "Request" and iff(isnotnull(toint(RequestSuccess)), RequestSuccess == false, RequestSuccess == "false") == true that shows failed requests, charts for failed requests over time and request duration and a list of failed request response codes.
异常 - 每小时异常数Exceptions - Exceptions per hour 显示每小时异常数的折线图。Shows a line chart of exceptions per hour. 将鼠标悬停在该图表上可以查看在特定的时间点发生异常次数最多的 3 个应用程序。Hover over the chart to see the top 3 applications with exceptions for a point in time. 此外,还显示应用程序列表以及每个应用程序的异常数目。Also shows a list of applications with the number of exceptions for each. 单击该图表可以针对 ApplicationInsights | where TelemetryType == "Exception" | summarize AggregatedValue = sum(SampledCount) by ApplicationName, bin(TimeGenerated, 1h) 运行日志搜索,显示异常数的更详细折线图。Click the chart to run a log search for ApplicationInsights | where TelemetryType == "Exception" | summarize AggregatedValue = sum(SampledCount) by ApplicationName, bin(TimeGenerated, 1h) that shows a more detailed link chart of exceptions.

单击列表中的某个项可以针对 ApplicationInsights | where ApplicationName == "yourapplicationname" and TelemetryType == "Exception" 运行日志搜索,显示异常数列表、不同时间的异常数图表、失败的请求数,以及异常类型列表。Click an item in the list to run a log search for ApplicationInsights | where ApplicationName == "yourapplicationname" and TelemetryType == "Exception" that shows a list of exceptions, charts for exceptions over time and failed requests, and a list of exception types.

单击仪表板中的任一项可以查看搜索中显示的 Application Insights 透视图。When you click any item in the dashboard, you see an Application Insights perspective shown in search. 透视图根据所选的遥测类型提供扩展的可视化效果。The perspective provides an extended visualization, based on the telemetry type that selected. 因此,可视化内容会根据不同的遥测类型变化。So, visualization content changes for different telemetry types.

单击“应用程序”边栏选项卡中的任意位置可以查看“应用程序”透视图。When you click anywhere in the Applications blade, you see the default Applications perspective.

Application Insights 中的“应用程序”透视图

该透视图显示所选应用程序的概述。The perspective shows an overview of the application that you selected.

“可用性”边栏选项卡显示一个不同的透视图,可在其中查看 Web 测试结果和相关的失败请求数。The Availability blade shows a different perspective view where you can see web test results and related failed requests.

Application Insights 中的“可用性”透视图

单击“服务器请求数”或“失败数”边栏选项卡中的任意位置时,透视图组件会发生变化,显示请求相关的可视化效果。When you click anywhere in the Server Requests or Failures blades, the perspective components change to give you a visualization that related to requests.

Application Insights 中的“失败数”边栏选项卡

单击“异常数”边栏选项卡中的任意位置可以查看根据异常数定制的可视化效果。When you click anywhere in the Exceptions blade, you see a visualization that's tailored to exceptions.

Application Insights 中的“异常”边栏选项卡

不管是否在“Application Insights 连接器”仪表板中单击了某项,在“搜索”页面本身中,返回 Application Insights 数据的任何查询都会显示 Application Insights 透视图。Regardless of whether you click something one the Application Insights Connector dashboard, within the Search page itself, any query returning Application Insights data shows the Application Insights perspective. 例如,查看 Application Insights 数据时,* 查询也会显示如下图所示的透视图选项卡:For example, if you are viewing Application Insights data, a * query also shows the perspective tab like the following image:

Application Insights

透视图组件根据搜索查询进行更新。Perspective components are updated depending on the search query. 这意味着,可以使用任何搜索字段来筛选结果,以便查看来自以下源的数据:This means that you can filter the results by using any search field that gives you the ability to see the data from:

  • 所有应用程序All your applications
  • 单个选定的应用程序A single selected application
  • 一组应用程序A group of applications

在 Azure 门户中透视应用Pivot to an app in the Azure portal

“Application Insights 连接器”边栏选项卡用来在你使用 Azure 门户时切换到选定的 Application Insights 应用。Application Insights Connector blades are designed to enable you to pivot to the selected Application Insights app when you use the Azure portal. 可以使用该解决方案作为高级监视平台来帮助排查应用问题。You can use the solution as a high-level monitoring platform that helps you troubleshoot an app. 在任何连接的应用程序中发现潜在问题时,可以在 Log Analytics 搜索中深入到该问题,或者直接透视 Application Insights 应用。When you see a potential problem in any of your connected applications, you can either drill into it in Log Analytics search or you can pivot directly to the Application Insights app.

若要透视,请单击每行末尾显示的省略号 (...),然后选择“在 Application Insights 中打开”。To pivot, click the ellipses () that appears at the end of each line, and select Open in Application Insights.

备注

Azure 门户中未提供“在 Application Insights 中打开”。Open in Application Insights is not available in the Azure portal.

在 Application Insights 中打开

采样更正数据Sample-corrected data

Application Insights 提供 采样更正 来帮助减少遥测流量。Application Insights provides sampling correction to help reduce telemetry traffic. 在 Application Insights 应用中启用采样时,可以减少 Application Insights 和 Log Analytics 中存储的条目数量。When you enable sampling on your Application Insights app, you get a reduced number of entries stored both in Application Insights and in Log Analytics. 尽管“Application Insights 连接器”页面和透视图中会保持数据一致性,但对于自定义查询,应手动更正采样的数据。While data consistency is preserved in the Application Insights Connector page and perspectives, you should manually correct sampled data for your custom queries.

下面日志搜索查询中的采样更正示例:Here is an example of sampling correction in a log search query:

ApplicationInsights | summarize AggregatedValue = sum(SampledCount) by TelemetryType

“采样计数”字段出现在所有条目中,显示条目代表的数据点数目。The Sampled Count field is present in all entries and shows the number of data points that the entry represents. 如果为 Application Insights 应用启用了采样,则“采样计数”大于 1。If you turn on sampling for your Application Insights app, Sampled Count is greater than 1. 若要统计应用程序生成的实际条目数,请对“采样计数”字段求和。To count the actual number of entries that your application generates, sum the Sampled Count fields.

采样只会影响应用程序生成的条目总数。Sampling affects only the total number of entries that your application generates. 不需要更正 RequestDurationAvailabilityDuration 等指标字段的采样,因为这些字段显示被代表条目的平均值。You don't need to correct sampling for metric fields like RequestDuration or AvailabilityDuration because those fields show the average for represented entries.

输入数据Input data

解决方案从连接的 Application Insights 应用接收以下遥测类型的数据:The solution receives the following telemetry types of data from your connected Application Insights apps:

  • 可用性Availability
  • 异常Exceptions
  • 请求Requests
  • 页面视图 - 要使工作区接收页面视图,必须将应用配置为收集该信息。Page views - For your workspace to receive page views, you must configure your apps to collect that information. 有关详细信息,请参阅 PageViewsFore more information, see PageViews.
  • 自定义事件 - 要使工作区接收自定义事件,必须将应用配置为收集该信息。Custom events - For your workspace to receive custom events, you must configure your apps to collect that information. 有关详细信息,请参阅 TrackEventFore more information, see TrackEvent.

数据可用后,Log Analytics 将从 Application Insights 接收该数据。Data is received by Log Analytics from Application Insights as it becomes available.

输出数据Output data

将为每种输入数据创建 ApplicationInsights 类型的记录。A record with a type of ApplicationInsights is created for each type of input data. ApplicationInsights 记录具有以下部分中所述的属性:ApplicationInsights records have properties shown in the following sections:

泛型字段Generic fields

属性Property 说明Description
类型Type ApplicationInsightsApplicationInsights
ClientIPClientIP
TimeGeneratedTimeGenerated 记录的时间Time of the record
ApplicationIdApplicationId Application Insights 应用的检测密钥Instrumentation key of the Application Insights app
ApplicationNameApplicationName Application Insights 应用的名称Name of the Application Insights app
RoleInstanceRoleInstance 服务器主机的 IDID of server host
DeviceTypeDeviceType 客户端设备Client device
ScreenResolutionScreenResolution
ContinentContinent 请求的来源大洲Continent where the request originated
国家/地区Country 请求的来源国家/地区Country/region where the request originated
ProvinceProvince 请求的来源省、州或区域Province, state, or locale where the request originated
城市City 请求的来源市或镇City or town where the request originated
isSyntheticisSynthetic 指示请求是由用户还是自动化方法创建的。Indicates whether the request was created by a user or by automated method. True = 由自动化方法生成,false = 由用户生成True = automated method or false = user generated
SamplingRateSamplingRate SDK 生成的、发送到门户的遥测百分比。Percentage of telemetry generated by the SDK that is sent to portal. 范围为 0.0-100.0。Range 0.0-100.0.
SampledCountSampledCount 100/(SamplingRate)。100/(SamplingRate). 例如,4 => 25%For example, 4 => 25%
IsAuthenticatedIsAuthenticated True 或 FalseTrue or false
OperationIDOperationID 具有相同操作 ID 的项在门户中显示为相关项。Items that have the same operation ID are shown as Related Items in the portal. 通常为请求 IDUsually the request ID
ParentOperationIDParentOperationID 父操作的 IDID of the parent operation
OperationNameOperationName
SessionIdSessionId 用于唯一标识创建请求所在的会话的 GUIDGUID to uniquely identify the session where the request was created
SourceSystemSourceSystem ApplicationInsightsApplicationInsights

可用性特定的字段Availability-specific fields

属性Property 说明Description
TelemetryTypeTelemetryType 可用性Availability
AvailabilityTestNameAvailabilityTestName Web 测试的名称Name of the web test
AvailabilityRunLocationAvailabilityRunLocation http 请求的地理来源Geographic source of http request
AvailabilityResultAvailabilityResult 指示 Web 测试的成功结果Indicates the success result of the web test
AvailabilityMessageAvailabilityMessage 附加到 Web 测试的消息The message attached to the web test
AvailabilityCountAvailabilityCount 100/(采样率)。100/(Sampling Rate). 例如,4 => 25%For example, 4 => 25%
DataSizeMetricValueDataSizeMetricValue 1.0 或 0.01.0 or 0.0
DataSizeMetricCountDataSizeMetricCount 100/(采样率)。100/(Sampling Rate). 例如,4 => 25%For example, 4 => 25%
AvailabilityDurationAvailabilityDuration Web 测试的持续时间,以毫秒为单位Time, in milliseconds, of the web test duration
AvailabilityDurationCountAvailabilityDurationCount 100/(采样率)。100/(Sampling Rate). 例如,4 => 25%For example, 4 => 25%
AvailabilityValueAvailabilityValue
AvailabilityMetricCountAvailabilityMetricCount
AvailabilityTestIdAvailabilityTestId Web 测试的唯一 GUIDUnique GUID for the web test
AvailabilityTimestampAvailabilityTimestamp 可用性测试的精确时间戳Precise timestamp of the availability test
AvailabilityDurationMinAvailabilityDurationMin 对于采样的记录,此字段显示被代表数据点的最小 Web 测试持续时间(毫秒)For sampled records, this field shows the minimum web test duration (milliseconds) for the represented data points
AvailabilityDurationMaxAvailabilityDurationMax 对于采样的记录,此字段显示被代表数据点的最大 Web 测试持续时间(毫秒)For sampled records, this field shows the maximum web test duration (milliseconds) for the represented data points
AvailabilityDurationStdDevAvailabilityDurationStdDev 对于采样的记录,此字段显示被代表数据点的所有 Web 测试持续时间(毫秒)之间的标准偏差For sampled records, this field shows the standard deviation between all web test durations (milliseconds) for the represented data points
AvailabilityMinAvailabilityMin
AvailabilityMaxAvailabilityMax
AvailabilityStdDevAvailabilityStdDev  

异常特定的字段Exception-specific fields

类型Type ApplicationInsightsApplicationInsights
TelemetryTypeTelemetryType 异常Exception
ExceptionTypeExceptionType 异常的类型Type of the exception
ExceptionMethodExceptionMethod 创建异常的方法The method that creates the exception
ExceptionAssemblyExceptionAssembly 程序集包含框架和版本以及公钥令牌Assembly includes the framework and version as well as the public key token
ExceptionGroupExceptionGroup 异常的类型Type of the exception
ExceptionHandledAtExceptionHandledAt 指示处理异常的级别Indicates the level that handled the exception
ExceptionCountExceptionCount 100/(采样率)。100/(Sampling Rate). 例如,4 => 25%For example, 4 => 25%
ExceptionMessageExceptionMessage 异常的消息Message of the exception
ExceptionStackExceptionStack 异常的完整堆栈Full stack of the exception
ExceptionHasStackExceptionHasStack 如果异常具有堆栈,则为 TrueTrue, if exception has a stack

请求特定的字段Request-specific fields

属性Property 说明Description
类型Type ApplicationInsightsApplicationInsights
TelemetryTypeTelemetryType 请求Request
ResponseCodeResponseCode 发送到客户端的 HTTP 响应HTTP response sent to client
RequestSuccessRequestSuccess 指示成功或失败。Indicates success or failure. True 或 False。True or false.
RequestIDRequestID 用于唯一标识请求的 IDID to uniquely identify the request
RequestNameRequestName GET/POST + URL 基GET/POST + URL base
RequestDurationRequestDuration 请求持续时间(秒)Time, in seconds, of the request duration
URLURL 请求的 URL,不包括主机URL of the request not including host
主机Host Web 服务器主机Web server host
URLBaseURLBase 请求的完整 URLFull URL of the request
ApplicationProtocolApplicationProtocol 应用程序使用的协议类型Type of protocol used by the application
RequestCountRequestCount 100/(采样率)。100/(Sampling Rate). 例如,4 => 25%For example, 4 => 25%
RequestDurationCountRequestDurationCount 100/(采样率)。100/(Sampling Rate). 例如,4 => 25%For example, 4 => 25%
RequestDurationMinRequestDurationMin 对于采样的记录,此字段显示被代表数据点的最小请求持续时间(毫秒)。For sampled records, this field shows the minimum request duration (milliseconds) for the represented data points.
RequestDurationMaxRequestDurationMax 对于采样的记录,此字段显示被代表数据点的最大请求持续时间(毫秒)For sampled records, this field shows the maximum request duration (milliseconds) for the represented data points
RequestDurationStdDevRequestDurationStdDev 对于采样的记录,此字段显示被代表数据点的所有请求持续时间(毫秒)之间的标准偏差For sampled records, this field shows the standard deviation between all request durations (milliseconds) for the represented data points

示例日志搜索Sample log searches

此解决方案不会在仪表板上显示一组示例日志搜索。This solution does not have a set of sample log searches shown on the dashboard. 但是,查看 Application Insights 连接器信息部分中显示了示例日志搜索查询与说明。However, sample log search queries with descriptions are shown in the View Application Insights Connector information section.

使用 PowerShell 删除连接器Removing the connector with PowerShell

随着 OMS 门户被弃用,将无法从门户中配置和删除现有的连接。With OMS portal deprecation, there is no way to configure and remove existing connections from the portal. 可使用以下 PowerShell 脚本删除现有连接。You can remove existing connections with the following PowerShell script. 必须是工作区的所有者或贡献者以及 Application Insights 资源的读者才能执行此操作。You must be the owner or contributor of the workspace and reader of Application Insights resource to perform this operation.

$Subscription_app = "App Subscription Name"
$ResourceGroup_app = "App ResourceGroup"
$Application = "Application Name"
$Subscription_workspace = "Workspace Subscription Name"
$ResourceGroup_workspace = "Workspace ResourceGroup"
$Workspace = "Workspace Name"

Connect-AzAccount
Set-AzContext -SubscriptionId $Subscription_app
$AIApp = Get-AzApplicationInsights -ResourceGroupName $ResourceGroup_app -Name $Application 
Set-AzContext -SubscriptionId $Subscription_workspace
Remove-AzOperationalInsightsDataSource -WorkspaceName $Workspace -ResourceGroupName $ResourceGroup_workspace -Name $AIApp.Id

你可以使用以下可调用 REST API 调用的 PowerShell 脚本来检索应用程序列表。You can retrieve a list of applications using the following PowerShell script that invokes a REST API call.

Connect-AzAccount
$Tenant = "TenantId"
$Subscription_workspace = "Workspace Subscription Name"
$ResourceGroup_workspace = "Workspace ResourceGroup"
$Workspace = "Workspace Name"
$AccessToken = "AAD Authentication Token" 

Set-AzContext -SubscriptionId $Subscription_workspace
$LAWorkspace = Get-AzOperationalInsightsWorkspace -ResourceGroupName $ResourceGroup_workspace -Name $Workspace

$Headers = @{
    "Authorization" = "Bearer $($AccessToken)"
    "x-ms-client-tenant-id" = $Tenant
}

$Connections = Invoke-RestMethod -Method "GET" -Uri "https://management.chinacloudapi.cn$($LAWorkspace.ResourceId)/dataSources/?%24filter=kind%20eq%20'ApplicationInsights'&api-version=2015-11-01-preview" -Headers $Headers
$ConnectionsJson = $Connections | ConvertTo-Json

此脚本需要持有者身份验证令牌才能对 Azure Active Directory 进行身份验证。This script requires a bearer authentication token for authentication against Azure Active Directory. 检索此令牌的一种方法是使用 REST API 文档站点中的文章。One way to retrieve this token is using an article in the REST API documentation site. 单击“试用”,然后登录 Azure 订阅。Click Try It and log into your Azure subscription. 可从“请求预览”复制持有者令牌,如下图所示。You can copy the bearer token from the Request Preview as shown in the following image.

持有者令牌

还可使用日志查询检索应用程序列表:You can also retrieve a list of applications use a log query:

ApplicationInsights | summarize by ApplicationName

后续步骤Next steps

  • 使用日志搜索可以查看 Application Insights 应用的详细信息。Use Log Search to view detailed information for your Application Insights apps.