Skip to content

Commit

Permalink
chore: fix nil pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Aug 28, 2024
1 parent f473d23 commit e218117
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions db/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,11 @@ func generateConfigChange(ctx api.ScrapeContext, newConf, prev models.ConfigItem

duration := time.Since(start)

ctx.Histogram("scraper_diff_duration",
[]float64{1, 10, 100, 1000, 10000}, "scraper", ctx.ScrapeConfig().GetPersistedID().String()).
Record(time.Duration(duration.Milliseconds()))
if ctx.ScrapeConfig() != nil {
ctx.Histogram("scraper_diff_duration",
[]float64{1, 10, 100, 1000, 10000}, "scraper", ctx.ScrapeConfig().GetPersistedID().String()).
Record(time.Duration(duration.Milliseconds()))
}

msg := fmt.Sprintf("generated in %dms for %s size=%s diff=%s",
duration.Milliseconds(),
Expand Down

0 comments on commit e218117

Please sign in to comment.