Skip to content

Conversation

@ArthurSens
Copy link
Member

@ArthurSens ArthurSens commented Dec 24, 2025

Description

This PR is built on top of prometheus/prometheus#17736. There are a lot of go mod changes, and that also inherits fixes to interface changes that were made since Prometheus 3.8

The only change that is really about making SDs removable is this change in imports in factory.go:

-	_ "github.com/prometheus/prometheus/discovery/install" // init() of this package registers service discovery impl.
+	_ "github.com/prometheus/prometheus/plugins" // init() of this package registers service discovery impl.

Link to tracking issue

Fixes #44406

Testing

Used two builder configs and measured the binary size difference:

Without build tags(120MB):

dist:
  module: github.com/open-telemetry/otelcontribcol
  name: otelcontribcol
  version: 0.143.0
  output_path: ./cmd/otelcontribcol/sd-test/full

receivers:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.143.0
    path: ./receiver/prometheusreceiver

exporters:
  - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.143.0

With build tags(63MG):

dist:
  module: github.com/open-telemetry/otelcontribcol
  name: otelcontribcol
  version: 0.143.0
  output_path: ./cmd/otelcontribcol/sd-test/no-sd
  build_tags: "remove_all_sd"

receivers:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.143.0
    path: ./receiver/prometheusreceiver

exporters:
  - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.143.0

@ArthurSens
Copy link
Member Author

I'm opening this PR just to show how it works, but discussions should be done upstream at prometheus/prometheus :)

@atoulme atoulme marked this pull request as draft January 2, 2026 07:28
@atoulme
Copy link
Contributor

atoulme commented Jan 2, 2026

Moving to draft since this is not to be merged.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 17, 2026
@ArthurSens ArthurSens marked this pull request as ready for review January 19, 2026 12:53
@ArthurSens
Copy link
Member Author

ArthurSens commented Jan 19, 2026

PR finally ready for review @dashpole :)

I've also updated the PR description to mention how to test these changes

Signed-off-by: Arthur Silva Sens <[email protected]>
Signed-off-by: Arthur Silva Sens <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[prometheusreceiver] Consider separating prom service discovery from the receiver module

4 participants