Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propogate name and transport for prometheus receiver and exporter #2680

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion receiver/prometheusreceiver/metrics_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/obsreport"
"go.opentelemetry.io/collector/receiver/prometheusreceiver/internal"
)

const transport = "http"

// pReceiver is the type that provides Prometheus scraper/receiver functionality.
type pReceiver struct {
cfg *Config
Expand Down Expand Up @@ -73,7 +76,8 @@ func (r *pReceiver) Start(ctx context.Context, host component.Host) error {
if !r.cfg.UseStartTimeMetric {
jobsMap = internal.NewJobsMap(2 * time.Minute)
}
ocaStore := internal.NewOcaStore(ctx, r.consumer, r.logger, jobsMap, r.cfg.UseStartTimeMetric, r.cfg.StartTimeMetricRegex, r.cfg.Name())
receiverCtx := obsreport.ReceiverContext(ctx, r.cfg.Name(), transport)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to start from context.Background() because the context from Start should not be stored and used later (not you bug, but please fix that as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was going to update this but it was merged. Do you need me to open another pr?

ocaStore := internal.NewOcaStore(receiverCtx, r.consumer, r.logger, jobsMap, r.cfg.UseStartTimeMetric, r.cfg.StartTimeMetricRegex, r.cfg.Name())

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