【问题标题】:How to troubleshoot telemetry delivery to an Application Insights bucket?如何对遥测传送到 Application Insights 存储桶进行故障排除?
【发布时间】:2020-04-30 21:35:45
【问题描述】:

我有一些将遥测数据发送到 Application Insights 的 powershell 代码。我们发现遥测停止到达人工智能,尽管代码没有改变。没有错误。

代码使用以下 Powershell 函数创建遥测客户端:

function New-TelemetryClient([Parameter(Mandatory)]$InstrumentationKey, $SessionKey)
{
    $MicrosoftApplicationInsightsDll = Get-LibraryFromNuGet Microsoft.ApplicationInsights net46 2.11.0
    Add-Type -Path $MicrosoftApplicationInsightsDll.FullName
    $tc = New-Object Microsoft.ApplicationInsights.TelemetryClient
    $tc.Context.InstrumentationKey = $InstrumentationKey
    if (!$SessionKey)
    {
        $SessionKey = [guid]::NewGuid().ToString()
    }
    $tc.Context.Session.Id = $SessionKey
    $tc
}

我们创建一个遥测客户端对象,调用一堆TrackEvent 方法来发送自定义事件,然后调用Flush。此代码在本地机器上运行良好,但不会从构建机器发送遥测数据。

奇怪的是,当我们更改 Instrumentation Key 时,它似乎确实可以在同一台构建机器上工作。很多奇怪的东西。

我想获得 Application Insights 的诊断输出,但找不到任何有关如何打开它的信息。

所以我的问题是 - 从 Powershell 发送到 Application Insights 时如何收集诊断消息?

【问题讨论】:

  • 有没有办法在构建机器上安装 Fiddler 并查看它是否发送并被拒绝或根本不发送?
  • 这里是另一个选项(假设这个 ikey 有问题,而不是一些连接问题):apmtips.com/blog/2015/11/07/…
  • 这有点旧 - 不确定它是否仍然有效。 Application Insigths SDK 发出 ETW 跟踪,可以使用 PerfView 等工具进行查看。 sergeysharp.com/blog/2015/04/16/…

标签: azure azure-application-insights


【解决方案1】:

有几个选项可用于对 Application Insights .NET SDK 进行故障排除:

  1. 使用 Fiddler 检查 HTTP 请求。这将有助于检测无效检测密钥等问题。
  2. 如果 AI SDK 不发出 HTTP 请求,请按照以下指南从 AI SDK 收集 ETW 事件:https://github.com/microsoft/ApplicationInsights-Home/tree/master/Samples/ETW#tools-to-collect-etw

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多