From 4f134e16586ed32cb5c36720acaee133d5f8c766 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 5 May 2022 16:22:23 -0700 Subject: [PATCH] Remove unnecessary context in prometheus receiver Signed-off-by: Bogdan Drutu --- receiver/prometheusreceiver/internal/ocastore.go | 4 ---- receiver/prometheusreceiver/metrics_receiver.go | 3 --- 2 files changed, 7 deletions(-) diff --git a/receiver/prometheusreceiver/internal/ocastore.go b/receiver/prometheusreceiver/internal/ocastore.go index cfd68d1c0d6e..bd949dc59e2e 100644 --- a/receiver/prometheusreceiver/internal/ocastore.go +++ b/receiver/prometheusreceiver/internal/ocastore.go @@ -29,8 +29,6 @@ var idSeq int64 // OcaStore translates Prometheus scraping diffs into OpenCensus format. type OcaStore struct { - ctx context.Context - sink consumer.Metrics jobsMap *JobsMap useStartTimeMetric bool @@ -43,7 +41,6 @@ type OcaStore struct { // NewOcaStore returns an ocaStore instance, which can be acted as prometheus' scrape.Appendable func NewOcaStore( - ctx context.Context, sink consumer.Metrics, set component.ReceiverCreateSettings, gcInterval time.Duration, @@ -56,7 +53,6 @@ func NewOcaStore( jobsMap = NewJobsMap(gcInterval) } return &OcaStore{ - ctx: ctx, sink: sink, settings: set, jobsMap: jobsMap, diff --git a/receiver/prometheusreceiver/metrics_receiver.go b/receiver/prometheusreceiver/metrics_receiver.go index 43e48165f230..ccb406cee3ff 100644 --- a/receiver/prometheusreceiver/metrics_receiver.go +++ b/receiver/prometheusreceiver/metrics_receiver.go @@ -77,10 +77,7 @@ func (r *pReceiver) Start(_ context.Context, host component.Host) error { } }() - // Per component.Component Start instructions, for async operations we should not use the - // incoming context, it may get cancelled. r.ocaStore = internal.NewOcaStore( - context.Background(), r.consumer, r.settings, gcInterval(r.cfg.PrometheusConfig),