Azure 애플리케이션 Insights 에이전트 문제 해결(이전의 상태 모니터 v2)

이 문서에서는 Microsoft Azure 애플리케이션 Insights 모니터링을 사용할 때 발생할 수 있는 데이터 수집 문제를 해결하는 데 도움이 되는 문제 해결 정보를 제공합니다.

알려진 문제

bin 폴더의 DLL 충돌

이러한 DLL(동적 연결 라이브러리)이 앱의 bin 폴더에 있는 경우 모니터링이 실패할 수 있습니다.

  • Microsoft.ApplicationInsights.dll
  • Microsoft.AspNet.TelemetryCorrelation.dll
  • System.Diagnostics.DiagnosticSource.dll

이러한 DLL 중 일부는 앱에서 사용하지 않더라도 Visual Studio 기본 앱 템플릿에 포함됩니다. 다음 도구와 같은 문제 해결 도구를 사용하여 증상 동작을 확인할 수 있습니다.

  • PerfView:

    ThreadID="7,500" 
    ProcessorNumber="0" 
    msg="Found 'System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' assembly, skipping attaching redfield binaries" 
    ExtVer="2.8.13.5972" 
    SubscriptionId="" 
    AppName="" 
    FormattedMessage="Found 'System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' assembly, skipping attaching redfield binaries" 
    
  • IISReset 및 앱 로드(원격 분석 제외) Sysinternals(Handle.exe 및 ListDLLs.exe)를 사용하여 조사합니다.

    .\handle64.exe -p w3wp | findstr /I "InstrumentationEngine AI. ApplicationInsights"
    E54: File  (R-D)   C:\Program Files\WindowsPowerShell\Modules\Az.ApplicationMonitor\content\Runtime\Microsoft.ApplicationInsights.RedfieldIISModule.dll
    
    .\Listdlls64.exe w3wp | findstr /I "InstrumentationEngine AI ApplicationInsights"
    0x0000000009be0000  0x127000  C:\Program Files\WindowsPowerShell\Modules\Az.ApplicationMonitor\content\Instrumentation64\MicrosoftInstrumentationEngine_x64.dll
    0x0000000009b90000  0x4f000   C:\Program Files\WindowsPowerShell\Modules\Az.ApplicationMonitor\content\Instrumentation64\Microsoft.ApplicationInsights.ExtensionsHost_x64.dll
    0x0000000004d20000  0xb2000   C:\Program Files\WindowsPowerShell\Modules\Az.ApplicationMonitor\content\Instrumentation64\Microsoft.ApplicationInsights.Extensions.Base_x64.dll
    

PowerShell 버전

이 제품은 PowerShell 버전 5.1을 사용하여 작성 및 테스트되었습니다. 이 모듈은 PowerShell 버전 6 또는 7과 호환되지 않습니다. 최신 버전과 함께 PowerShell 5.1을 사용하는 것이 좋습니다. 자세한 내용은 PowerShell 5.1과 함께 PowerShell 7을 사용하는 것을 참조하세요.

IIS 공유 구성에서 충돌

웹 서버 클러스터가 있는 경우 공유 구성을 사용하고 있을 수 있습니다. HTTP 모듈은 이 공유 구성에 삽입할 수 없습니다. 각 웹 서버에서 Enable 명령을 실행하여 각 서버의 GAC(전역 어셈블리 캐시)에 DLL을 설치합니다.

Enable 명령을 실행한 후 다음 단계를 수행합니다.

  1. 공유 구성 디렉터리로 이동하여 ApplicationHost.config 파일을 찾습니다.

  2. 구성의 모듈> 섹션에 <다음 XML 코드를 추가합니다.

    <modules>
        <!-- Registered global managed http module handler. The 'Microsoft.AppInsights.IIS.
        ManagedHttpModuleHelper.dll' must be installed in the GAC before this config is applied. -->
        <add name="ManagedHttpModuleHelper" type="Microsoft.AppInsights.IIS.ManagedHttpModuleHelper.
        ManagedHttpModuleHelper, Microsoft.AppInsights.IIS.ManagedHttpModuleHelper, Version=1.0.0.0, 
        Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" />
    </modules>
    

IIS 중첩된 애플리케이션

Application Insights 에이전트 버전 1.0에서는 IIS(인터넷 정보 서비스)에서 중첩된 애플리케이션을 계측하지 않습니다.

IIS 클래식 파이프라인 모드

클래식 파이프라인 모드를 사용하도록 구성된 경우 애플리케이션 풀에서 호스트되는 애플리케이션을 계측하지 않습니다.

고급 SDK 구성을 사용할 수 없음

SDK 구성은 버전 1.0의 최종 사용자에게 노출되지 않습니다.

PowerShell 문제 해결

사용할 수 있는 모듈 확인

설치된 모듈을 확인하려면 cmdlet을 Get-Module -ListAvailable 실행합니다.

모듈을 현재 세션으로 가져오기

모듈이 PowerShell 세션에 로드되지 않은 경우 cmdlet을 실행 Import-Module <path-to-psd1> 하여 수동으로 로드할 수 있습니다.

Application Insights 에이전트 모듈 문제 해결

Application Insights 에이전트 모듈에서 사용할 수 있는 cmdlet 나열

Application Insights 에이전트 모듈에서 사용할 수 있는 cmdlet을 보려면 cmdlet을 Get-Command -Module Az.ApplicationMonitor 실행합니다.

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Disable-ApplicationInsightsMonitoring              0.4.0      Az.ApplicationMonitor
Cmdlet          Disable-InstrumentationEngine                      0.4.0      Az.ApplicationMonitor
Cmdlet          Enable-ApplicationInsightsMonitoring               0.4.0      Az.ApplicationMonitor
Cmdlet          Enable-InstrumentationEngine                       0.4.0      Az.ApplicationMonitor
Cmdlet          Get-ApplicationInsightsMonitoringConfig            0.4.0      Az.ApplicationMonitor
Cmdlet          Get-ApplicationInsightsMonitoringStatus            0.4.0      Az.ApplicationMonitor
Cmdlet          Set-ApplicationInsightsMonitoringConfig            0.4.0      Az.ApplicationMonitor
Cmdlet          Start-ApplicationInsightsMonitoringTrace           0.4.0      Az.ApplicationMonitor

Application Insights 에이전트 모듈의 현재 버전 확인

cmdlet을 Get-ApplicationInsightsMonitoringStatus -PowerShellModule 실행하여 모듈에 대한 다음 정보를 표시합니다.

  • PowerShell 모듈 버전
  • Application Insights SDK 버전
  • PowerShell 모듈의 파일 경로

이 cmdlet을 사용하는 방법에 대한 자세한 설명은 Get-ApplicationInsightsMonitoringStatus 참조 를 검토하세요.

실행 중인 프로세스 문제 해결

계측된 컴퓨터의 프로세스를 검사하여 모든 DLL이 로드되고 환경 변수가 설정되었는지 여부를 확인할 수 있습니다. 모니터링이 작동하는 경우 12개 이상의 DLL이 로드되어야 합니다.

  • cmdlet을 Get-ApplicationInsightsMonitoringStatus -InspectProcess 실행하여 DLL을 확인합니다.
  • cmdlet을 (Get-Process -id <process-identifier>).StartInfo.EnvironmentVariables 실행하여 환경 변수를 확인합니다. 다음 환경 변수는 작업자 프로세스 또는 .NET Core 프로세스에서 설정됩니다.
COR_ENABLE_PROFILING=1
COR_PROFILER={324F817A-7420-4E6D-B3C1-143FBED6D855}
COR_PROFILER_PATH_32=<path-to-MicrosoftInstrumentationEngine_x86.dll>
COR_PROFILER_PATH_64=<path-to-MicrosoftInstrumentationEngine_x64.dll>
MicrosoftInstrumentationEngine_Host={CA487940-57D2-10BF-11B2-A3AD5A13CBC0}
MicrosoftInstrumentationEngine_HostPath_32=<path-to-Microsoft.ApplicationInsights.ExtensionsHost_x86.dll>
MicrosoftInstrumentationEngine_HostPath_64=<path-to-Microsoft.ApplicationInsights.ExtensionsHost_x64.dll>
MicrosoftInstrumentationEngine_ConfigPath32_Private=<path-to-Microsoft.InstrumentationEngine.Extensions.config>
MicrosoftInstrumentationEngine_ConfigPath64_Private=<path-to-Microsoft.InstrumentationEngine.Extensions.config>
MicrosoftAppInsights_ManagedHttpModulePath=<path-to-Microsoft.ApplicationInsights.RedfieldIISModule.dll>
MicrosoftAppInsights_ManagedHttpModuleType=Microsoft.ApplicationInsights.RedfieldIISModule.RedfieldIISModule
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=Microsoft.ApplicationInsights.StartupBootstrapper
DOTNET_STARTUP_HOOKS=<path-to-Microsoft.ApplicationInsights.StartupHook.dll>

이 cmdlet을 사용하는 방법에 대한 자세한 설명은 Get-ApplicationInsightsMonitoringStatus 참조 를 검토하세요.

PerfView를 사용하여 ETW 로그 수집

설정

  1. GitHub에서 PerfView.exe 다운로드합니다.

  2. PerfView.exe 실행합니다.

  3. 메뉴 모음에서 수집 수집>을 선택합니다.

  4. 고급 옵션을 확장합니다.

  5. 다음 확인란의 선택을 취소합니다.

    • Zip
    • 병합
    • .NET 기호 컬렉션
  6. 다음 추가 공급자를 설정합니다.

    *Microsoft-ApplicationInsights-AspNetCore,*Microsoft-ApplicationInsights-AspNetCore-AiHostingStartup,*Microsoft-ApplicationInsights-AspNetCore-StartupBootstrapper,*Microsoft-ApplicationInsights-AspNetCore-StartupHook,*Microsoft-ApplicationInsights-Core,*Microsoft-ApplicationInsights-Data,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Microsoft-ApplicationInsights-Extensibility-HostingStartup,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Microsoft-ApplicationInsights-Extensibility-Web,*Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Microsoft-ApplicationInsights-FrameworkLightup,*Microsoft-ApplicationInsights-IIS-ManagedHttpModuleHelper,*Microsoft-ApplicationInsights-Java-IPA,*Microsoft-ApplicationInsights-LoggerProvider,*Microsoft-ApplicationInsights-Nodejs-IPA,*Microsoft-ApplicationInsights-RedfieldIISModule,*Microsoft-ApplicationInsights-SnapshotCollectorLightup,*Microsoft-ApplicationInsights-WindowsServer-Core,*Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel,*Redfield-Microsoft-ApplicationInsights-AspNetCore,*Redfield-Microsoft-ApplicationInsights-Core,*Redfield-Microsoft-ApplicationInsights-Data,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Dependency,*Redfield-Microsoft-ApplicationInsights-Extensibility-AppMapCorrelation-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-DependencyCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventCounterCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-EventSourceListener,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector,*Redfield-Microsoft-ApplicationInsights-Extensibility-PerformanceCollector-QuickPulse,*Redfield-Microsoft-ApplicationInsights-Extensibility-Web,*Redfield-Microsoft-ApplicationInsights-Extensibility-WindowsServer,*Redfield-Microsoft-ApplicationInsights-LoggerProvider,*Redfield-Microsoft-ApplicationInsights-WindowsServer-TelemetryChannel

로그 수집

  1. 관리 명령 프롬프트에서 명령을 실행 iisreset /stop 하여 IIS 및 모든 웹앱을 끕니다.

  2. PerfView에서 컬렉션 시작을 선택합니다.

  3. 관리 명령 프롬프트에서 명령을 실행 iisreset /start 하여 IIS를 시작합니다.

  4. 앱으로 이동해 보세요.

  5. 앱이 로드되면 PerfView로 돌아가서 컬렉션 중지를 선택합니다.

다음 단계

  • API 참조검토하여 누락되었을 수 있는 매개 변수에 대해 알아봅니다.

도움을 요청하십시오.

질문이 있거나 도움이 필요한 경우 지원 요청을 생성하거나Azure 커뮤니티 지원에 문의하세요. Azure 피드백 커뮤니티에 제품 피드백을 제출할 수도 있습니다.