Not all collectors are available on all platforms – in many cases, due to the platform dependent code, they won't even compile. This structure allows us to selectively compile the various collector files, and those that are getting compiled register themselves.
Additionally, this structure allows third party software to re-use the collectors, for example as part of a bundled "one binary to rule them all" style uber-exporter. /MR On Wed, Jul 27, 2022, 10:18 Siddhant Gupta <siddhant.gupta...@gmail.com> wrote: > I am reading the code of node_exporter and I could not understand why do > we have a generic collector.go that maintains all the various collectors > and registers a generic Collector interface with prometheus? > > Couldn't we register all the collector directly with prometheus? > > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to prometheus-developers+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-developers/1034f67a-7e48-482a-b3e3-c04befb0ca6an%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-developers/1034f67a-7e48-482a-b3e3-c04befb0ca6an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAMV%3D_gYPCJEq_NGKKvHBAVDgbs3D0NeYPRxhS1TBpKZq%3DUv68Q%40mail.gmail.com.