Skip to content

Remove boilerplate code by adopting exporter-toolkit's bootstrap.Runner() - #3660

Merged
ArthurSens merged 1 commit into
prometheus:masterfrom
nicolastakashi:embeddable-config-foundation
Aug 27, 2026
Merged

ArthurSens merged 1 commit into
prometheus:masterfrom
nicolastakashi:embeddable-config-foundation

Conversation

@nicolastakashi

@nicolastakashi nicolastakashi commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

This starts a small, incremental refactor to make node_exporter easier to embed outside the standalone binary.

The broader goal is to support ongoing work to make Prometheus exporters embeddable inside the Prometheus OpenTelemetry Collector distribution as native receivers, without requiring each exporter to be rewritten as an OpenTelemetry component.

As a first step, this PR introduces a standalone config package that:

  • defines a reusable top-level Config type
  • provides shared defaults for top-level exporter settings
  • centralizes validation for those settings

This does not make node_exporter fully embeddable yet. It is intended as groundwork for follow-up changes that will extract reusable runtime construction from the CLI layer and gradually reduce process-global configuration wiring.

Why

Today, top-level exporter configuration is constructed directly in the binary entrypoint. Moving that configuration shape into a reusable package gives downstream callers and future runtime code a shared place for:

  • defaults
  • validation
  • config construction independent of CLI parsing

That is a useful first step toward separating:

  • binary concerns such as flags, HTTP serving, and process setup
  • reusable exporter concerns such as config and collector/runtime construction

Comment thread config/config.go Outdated

@ArthurSens ArthurSens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just needs a rebase, I believe :)

@nicolastakashi
nicolastakashi force-pushed the embeddable-config-foundation branch from f1b2dcc to 921631f Compare August 25, 2026 18:17
@nicolastakashi

Copy link
Copy Markdown
Contributor Author

@ArthurSens PTAL 🙏🏽

@ArthurSens ArthurSens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just realized that moving to a new server mux will disable /debug/pprof since we're just importing the global _ "net/http/pprof".

Could we add it as a additional route to the bootstrap server mux?

@ArthurSens

Copy link
Copy Markdown
Member

The commit history and PR title also look a bit weird, so we might need to make some adjustments there 😬

@nicolastakashi
nicolastakashi force-pushed the embeddable-config-foundation branch 2 times, most recently from b117f4b to ac17919 Compare August 26, 2026 18:43
Refactor node_exporter's entrypoint to build its configuration and
run via the exporter-toolkit bootstrap runner, as groundwork for
making node_exporter easier to embed outside the standalone binary.

Register /debug/pprof/ on the bootstrap mux via Bootstrap.Handle so
it stays reachable now that the bootstrap runner uses its own mux
instead of http.DefaultServeMux.

Signed-off-by: Nicolas Takashi <nicolas.tcs@hotmail.com>
@nicolastakashi
nicolastakashi force-pushed the embeddable-config-foundation branch from ac17919 to 1dece8a Compare August 27, 2026 05:32

@ArthurSens ArthurSens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ArthurSens ArthurSens changed the title config: add reusable exporter config package Remove boilerplate code by adopting exporter-toolkit's bootstrap.Runner() Aug 27, 2026
@ArthurSens
ArthurSens merged commit baa938b into prometheus:master Aug 27, 2026
22 of 23 checks passed
@SuperQ

SuperQ commented Aug 27, 2026

Copy link
Copy Markdown
Member

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants