File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/PerfProblemSimulator/Controllers Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 11using Microsoft . ApplicationInsights ;
22using Microsoft . AspNetCore . Http . Timeouts ;
33using Microsoft . AspNetCore . Mvc ;
4+ using Microsoft . Extensions . DependencyInjection ;
45using PerfProblemSimulator . Services ;
56
67namespace PerfProblemSimulator . Controllers ;
@@ -41,12 +42,13 @@ public AdminController(
4142 ISimulationTracker simulationTracker ,
4243 IMemoryPressureService memoryPressureService ,
4344 ILogger < AdminController > logger ,
44- TelemetryClient ? telemetryClient = null )
45+ IServiceProvider serviceProvider )
4546 {
4647 _simulationTracker = simulationTracker ?? throw new ArgumentNullException ( nameof ( simulationTracker ) ) ;
4748 _memoryPressureService = memoryPressureService ?? throw new ArgumentNullException ( nameof ( memoryPressureService ) ) ;
4849 _logger = logger ;
49- _telemetryClient = telemetryClient ;
50+ // Safely try to get TelemetryClient - may not be registered if App Insights not configured
51+ _telemetryClient = serviceProvider . GetService < TelemetryClient > ( ) ;
5052 }
5153
5254 /// <summary>
You can’t perform that action at this time.
0 commit comments