Skip to content

Commit

Permalink
chore: record config_id incremental_scrape_lag behind lag
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Feb 5, 2025
1 parent 147a2f5 commit 3ecb7e5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scrapers/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"time"

"github.com/flanksource/commons/properties"
"github.com/flanksource/config-db/api"
v1 "github.com/flanksource/config-db/api/v1"
"github.com/flanksource/config-db/db"
Expand Down Expand Up @@ -128,7 +129,13 @@ 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)).
labels := []string{"scraper_id", lo.FromPtr(config.ScraperID), "type", lo.FromPtr(config.Type)}
// Useful for debugging but inefficient for long term as it creates too many series
if properties.On(false, "incremental_scrape_event.record_config_id") {
labels = append(labels, "config_id", configID)
}

ctx.Histogram("incremental_scrape_event", involvedObjectsFetchBuckets, labels...).
Record(time.Duration(time.Since(event.CreatedAt).Milliseconds()))

return nil
Expand Down

0 comments on commit 3ecb7e5

Please sign in to comment.