Skip to content

Commit

Permalink
chore: record incremental scrape from event lag
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Feb 4, 2025
1 parent b889201 commit f29a7b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scrapers/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func incrementalScrapeFromEvent(ctx context.Context, event models.Event) error {
return fmt.Errorf("failed to get config (%s): %w", configID, err)
}

if config.DeletedAt != nil || time.Since(lo.FromPtr(config.LastScrapedTime)) <= time.Second*30 {
if config.DeletedAt != nil {
// assume the health is upto-date
return nil
}
Expand Down Expand Up @@ -128,5 +128,8 @@ func incrementalScrapeFromEvent(ctx context.Context, event models.Event) error {
}
}

ctx.Histogram("incremental_scrape_event", involvedObjectsFetchBuckets, "scraper_id", lo.FromPtr(config.ScraperID), "type", lo.FromPtr(config.Type)).
Record(time.Duration(time.Since(event.CreatedAt).Milliseconds()))

return nil
}

0 comments on commit f29a7b9

Please sign in to comment.