@@ -299,6 +299,16 @@ func extractChanges(ctx api.ScrapeContext, result *v1.ScrapeResult, ci *models.C
299299 continue
300300 }
301301
302+ if exclude , err := shouldExcludeChange (ctx , result , changeResult ); err != nil {
303+ ctx .JobHistory ().AddError (fmt .Sprintf ("error running change exclusion: %v" , err ))
304+ } else if exclude {
305+ changeSummary .AddIgnored (changeResult .ChangeType )
306+ if logExclusions {
307+ ctx .Logger .V (3 ).Infof ("excluded change: %v" , changeResult )
308+ }
309+ continue
310+ }
311+
302312 if changeResult .ConfigID != "" {
303313 if _ , ok := OrphanCache .Get (changeResult .ConfigID ); ok {
304314 changeSummary .AddOrphaned (changeResult .ChangeType , changeResult .ConfigID )
@@ -313,16 +323,6 @@ func extractChanges(ctx api.ScrapeContext, result *v1.ScrapeResult, ci *models.C
313323 }
314324 }
315325
316- if exclude , err := shouldExcludeChange (ctx , result , changeResult ); err != nil {
317- ctx .JobHistory ().AddError (fmt .Sprintf ("error running change exclusion: %v" , err ))
318- } else if exclude {
319- changeSummary .AddIgnored (changeResult .ChangeType )
320- if logExclusions {
321- ctx .Logger .V (3 ).Infof ("excluded change: %v" , changeResult )
322- }
323- continue
324- }
325-
326326 if changeResult .Action == v1 .Delete {
327327 if err := deleteChangeHandler (ctx , changeResult ); err != nil {
328328 return nil , nil , changeSummary , fmt .Errorf ("failed to delete config from change: %w" , err )
0 commit comments