@@ -153,7 +153,7 @@ public CollectorHealthSummary GetHealthSummary(int? serverId = null)
153153 /// <summary>
154154 /// Records a collector execution result for health tracking.
155155 /// </summary>
156- private void RecordCollectorResult ( int serverId , string collectorName , bool success , string ? errorMessage = null )
156+ private void RecordCollectorResult ( int serverId , string collectorName , string status , string ? errorMessage = null )
157157 {
158158 lock ( _healthLock )
159159 {
@@ -164,12 +164,20 @@ private void RecordCollectorResult(int serverId, string collectorName, bool succ
164164 _collectorHealth [ key ] = entry ;
165165 }
166166
167- if ( success )
167+ if ( status == "SUCCESS" )
168168 {
169169 entry . LastSuccessTime = DateTime . UtcNow ;
170170 entry . ConsecutiveErrors = 0 ;
171171 entry . TotalSuccesses ++ ;
172172 }
173+ else if ( status == "PERMISSIONS" )
174+ {
175+ /* Permission errors are not transient — don't count as failures
176+ (which would show FAILING) but don't count as success either.
177+ Record the error message so the user can see what's wrong. */
178+ entry . LastErrorTime = DateTime . UtcNow ;
179+ entry . LastErrorMessage = errorMessage ;
180+ }
173181 else
174182 {
175183 entry . LastErrorTime = DateTime . UtcNow ;
@@ -337,6 +345,7 @@ public async Task RunCollectorAsync(ServerConnection server, string collectorNam
337345 }
338346 else if ( ex . Number == 229 || ex . Number == 297 || ex . Number == 300 )
339347 {
348+ status = "PERMISSIONS" ;
340349 _logger ? . LogWarning ( "Collector '{Collector}' permission denied for server '{Server}': {Message}" ,
341350 collectorName , server . DisplayName , ex . Message ) ;
342351 }
@@ -369,7 +378,7 @@ public async Task RunCollectorAsync(ServerConnection server, string collectorNam
369378 }
370379
371380 // Track collector health
372- RecordCollectorResult ( GetServerId ( server ) , collectorName , status == "SUCCESS" , errorMessage ) ;
381+ RecordCollectorResult ( GetServerId ( server ) , collectorName , status , errorMessage ) ;
373382
374383 // Log the collection attempt
375384 await LogCollectionAsync ( GetServerId ( server ) , server . DisplayName , collectorName , startTime , status , errorMessage , rowsCollected , _lastSqlMs , _lastDuckDbMs ) ;
0 commit comments