File tree Expand file tree Collapse file tree
src/PerfProblemSimulator/Controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,20 +148,34 @@ public IActionResult TestAppInsights()
148148 {
149149 try
150150 {
151- _telemetryClient . TrackEvent ( "TestEvent" , new Dictionary < string , string >
151+ // Try simplest possible TrackEvent first (no properties)
152+ _telemetryClient . TrackEvent ( "TestEvent_Simple" ) ;
153+ diagnostics . TestEventSent = true ;
154+
155+ // Now try with properties
156+ var props = new Dictionary < string , string >
152157 {
153158 [ "TestId" ] = testId . ToString ( ) ,
154- [ "Source" ] = "AdminController.TestAppInsights"
155- } ) ;
159+ [ "Source" ] = "AdminController"
160+ } ;
161+ _telemetryClient . TrackEvent ( "TestEvent_WithProps" , props ) ;
162+
163+ // Also try TrackTrace
164+ _telemetryClient . TrackTrace ( $ "TestTrace - TestId: { testId } ") ;
165+
156166 _telemetryClient . Flush ( ) ;
157167 Thread . Sleep ( 500 ) ;
158168
159- diagnostics . TestEventSent = true ;
160- _logger . LogWarning ( "🧪 TEST EVENT sent - TestId: {TestId}" , testId ) ;
169+ _logger . LogWarning ( "🧪 TEST EVENTS sent - TestId: {TestId}" , testId ) ;
161170 }
162171 catch ( Exception ex )
163172 {
164- diagnostics . Error = $ "TrackEvent threw: { ex . Message } ";
173+ diagnostics . Error = $ "Telemetry threw: { ex . GetType ( ) . Name } : { ex . Message } ";
174+ // Include inner exception if present
175+ if ( ex . InnerException != null )
176+ {
177+ diagnostics . Error += $ " Inner: { ex . InnerException . Message } ";
178+ }
165179 }
166180 }
167181 else
You can’t perform that action at this time.
0 commit comments