如何排除向 Application Insights 桶发送遥测的故障?

问题描述 投票:0回答:1

我有一些将遥测发送到 Application Insights 的 powershell 代码。我们发现,尽管代码没有变化,但遥测停止到达AI。没有错误。

代码使用以下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时,我如何收集诊断信息?

azure azure-application-insights
1个回答
0
投票

有几个选项可以用来排除Application Insights .NET SDK的故障。

  1. 使用Fiddler来检查HTTP请求。这将有助于检测无效的工具键等问题。
  2. 如果AI SDK不进行HTTP请求,那么请按照以下指导从AI SDK收集ETW事件。https:/github.commicrosoftApplicationInsights-HometreemasterSamplesETW#tools-to-collect-etw。
© www.soinside.com 2019 - 2024. All rights reserved.