跟踪严重性比下降(预览)Degradation in trace severity ratio (preview)

跟踪广泛应用于应用程序,因为它们可以告知幕后发生的事情。Traces are widely used in applications, as they help tell the story of what happens behind the scenes. 出现错误时,跟踪可保证导致不理想状态事件序列的关键可见性。When things go wrong, traces provide crucial visibility into the sequence of events leading to the undesired state. 虽然跟踪通常已非结构化,但通过跟踪可以具体了解到一件事情,即其严重性级别。While traces are generally unstructured, there is one thing that can concretely be learned from them - their severity level. 在应用程序稳定状态下,“良好”跟踪(Info 和 Verbose)和“错误”跟踪(Warning、Error 和 Critical)之间的比率应保持稳定 。In an application’s steady state, we would expect the ratio between “good” traces ( Info and Verbose ) and “bad” traces ( Warning , Error , and Critical ) to remain stable. 假设情况是不管出于什么情况(例如暂时性网络故障),在一定的程度都会定期发生“错误”跟踪。The assumption is that “bad” traces may happen on a regular basis to a certain extent due to any number of reasons (transient network issues for instance). 但当一个真正的问题日益严重时,这通常表现为“错误”跟踪和“良好”跟踪之间的相关比率增大。But when a real problem begins growing, it usually manifests as an increase in the relative proportion of “bad” traces vs “good” traces. Application Insights 智能检测自动分析应用程序记录的跟踪,并在跟踪遥测的严重性级别出现异常时发出警告。Application Insights Smart Detection automatically analyzes the traces logged by your application, and can warn you about unusual patterns in the severity of your trace telemetry.

此功能需要为应用配置跟踪日志(请参见如何为 .NETJava 配置跟踪日志侦听器),除此之外,不需要其他特殊步骤。This feature requires no special setup, other than configuring trace logging for your app (see how to configure a trace log listener for .NET or Java). 在应用生成足够多的异常遥测数据后,此功能会激活。It is active when your app generates enough exception telemetry.

何时会收到此类型的智能检测通知?When would I get this type of smart detection notification?

对比前面七天计算的基线,如果“良好”跟踪(跟踪级别记录为 Info 或 Verbose)和“错误”跟踪(跟踪级别记录为 Warning、Error 或 Fatal)之间的比率在某一天降低,则可能会收到此类型通知 。You might get this type of notification if the ratio between “good” traces (traces logged with a level of Info or Verbose ) and “bad” traces (traces logged with a level of Warning , Error , or Fatal ) is degrading in a specific day, compared to a baseline calculated over the previous seven days.

收到通知是否意味着我的应用肯定有问题?Does my app definitely have a problem?

不是,通知并不意味着应用肯定有问题。No, a notification doesn't mean that your app definitely has a problem. 虽然“良好”和“错误”跟踪之间的比率降低可能指示应用程序出现问题,但这种比率的变化也可能是良性的。Although a degradation in the ratio between “good” and “bad” traces might indicate an application issue, this change in ratio might be benign. 例如,如果应用程序中的新流发出的“错误”跟踪多于现有流,则可能带来比率的增加。For example, the increase might be due to a new flow in the application emitting more “bad” traces than existing flows).

如何解决问题?How do I fix it?

通知包括诊断信息,以在诊断进程中提供支持:The notifications include diagnostic information to support in the diagnostics process:

  1. 会审。Triage. 通知会显示有多少操作受到影响。The notification shows you how many operations are affected. 这可以帮助你对问题分配优先级。This can help you assign a priority to the problem.
  2. 划分范围。Scope. 该问题是影响所有流量,还是只影响某些操作?Is the problem affecting all traffic, or just some operation? 可以从通知中获取此信息。This information can be obtained from the notification.
  3. 诊断。Diagnose. 可以使用链接到支持信息的相关项和报告,帮助进一步诊断问题。You can use the related items and reports linking to supporting information, to help you further diagnose the issue.