Skip to content

Commit

Permalink
Fix prometheusreceiver context, avoid using start context (#2737)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Mar 19, 2021
1 parent 76237c7 commit dbf45c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion receiver/prometheusreceiver/metrics_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func (r *pReceiver) Start(ctx context.Context, host component.Host) error {
if !r.cfg.UseStartTimeMetric {
jobsMap = internal.NewJobsMap(2 * time.Minute)
}
receiverCtx := obsreport.ReceiverContext(ctx, r.cfg.Name(), transport)
// Per component.Component Start instructions, for async operations we should not use the
// incoming context, it may get cancelled.
receiverCtx := obsreport.ReceiverContext(context.Background(), r.cfg.Name(), transport)
ocaStore := internal.NewOcaStore(receiverCtx, r.consumer, r.logger, jobsMap, r.cfg.UseStartTimeMetric, r.cfg.StartTimeMetricRegex, r.cfg.Name())

scrapeManager := scrape.NewManager(logger, ocaStore)
Expand Down

0 comments on commit dbf45c9

Please sign in to comment.