prometheus: Optionally remove more service discovery.

Almost all service discovery can now be disabled, except for DNS-,
HTTP-, and file-based service discovery, which do not appear to include
extra code in the binary.

Before this change, bin/prometheus was about 38M and bin/promtool was
51M. Now, bin/prometheus is about 31M and bin/promtool is about 44M.
Assuming all service discovery is disabled, of course.
This commit is contained in:
Corbin 2022-02-06 15:16:27 -08:00
parent 175cc7efd2
commit f3cc015b87

View file

@ -11,10 +11,22 @@
, fetchpatch , fetchpatch
, enableAWS ? true , enableAWS ? true
, enableAzure ? true , enableAzure ? true
, enableConsul ? true
, enableDigitalOcean ? true , enableDigitalOcean ? true
, enableEureka ? true
, enableGCE ? true , enableGCE ? true
, enableHetzner ? true
, enableKubernetes ? true , enableKubernetes ? true
, enableLinode ? true , enableLinode ? true
, enableMarathon ? true
, enableMoby ? true
, enableOpenstack ? true
, enablePuppetDB ? true
, enableScaleway ? true
, enableTriton ? true
, enableUyuni ? true
, enableXDS ? true
, enableZookeeper ? true
}: }:
let let
@ -104,14 +116,38 @@ buildGoModule rec {
"sed -i -e '/register aws/d' discovery/install/install.go"} "sed -i -e '/register aws/d' discovery/install/install.go"}
${lib.optionalString (!enableAzure) ${lib.optionalString (!enableAzure)
"sed -i -e '/register azure/d' discovery/install/install.go"} "sed -i -e '/register azure/d' discovery/install/install.go"}
${lib.optionalString (!enableConsul)
"sed -i -e '/register consul/d' discovery/install/install.go"}
${lib.optionalString (!enableDigitalOcean) ${lib.optionalString (!enableDigitalOcean)
"sed -i -e '/register digitalocean/d' discovery/install/install.go"} "sed -i -e '/register digitalocean/d' discovery/install/install.go"}
${lib.optionalString (!enableEureka)
"sed -i -e '/register eureka/d' discovery/install/install.go"}
${lib.optionalString (!enableGCE) ${lib.optionalString (!enableGCE)
"sed -i -e '/register gce/d' discovery/install/install.go"} "sed -i -e '/register gce/d' discovery/install/install.go"}
${lib.optionalString (!enableHetzner)
"sed -i -e '/register hetzner/d' discovery/install/install.go"}
${lib.optionalString (!enableKubernetes) ${lib.optionalString (!enableKubernetes)
"sed -i -e '/register kubernetes/d' discovery/install/install.go"} "sed -i -e '/register kubernetes/d' discovery/install/install.go"}
${lib.optionalString (!enableLinode) ${lib.optionalString (!enableLinode)
"sed -i -e '/register linode/d' discovery/install/install.go"} "sed -i -e '/register linode/d' discovery/install/install.go"}
${lib.optionalString (!enableMarathon)
"sed -i -e '/register marathon/d' discovery/install/install.go"}
${lib.optionalString (!enableMoby)
"sed -i -e '/register moby/d' discovery/install/install.go"}
${lib.optionalString (!enableOpenstack)
"sed -i -e '/register openstack/d' discovery/install/install.go"}
${lib.optionalString (!enablePuppetDB)
"sed -i -e '/register puppetdb/d' discovery/install/install.go"}
${lib.optionalString (!enableScaleway)
"sed -i -e '/register scaleway/d' discovery/install/install.go"}
${lib.optionalString (!enableTriton)
"sed -i -e '/register triton/d' discovery/install/install.go"}
${lib.optionalString (!enableUyuni)
"sed -i -e '/register uyuni/d' discovery/install/install.go"}
${lib.optionalString (!enableXDS)
"sed -i -e '/register xds/d' discovery/install/install.go"}
${lib.optionalString (!enableZookeeper)
"sed -i -e '/register zookeeper/d' discovery/install/install.go"}
''; '';
tags = [ "builtinassets" ]; tags = [ "builtinassets" ];