From f3cc015b87ffad59c38f91ffe4d84a66e90964b9 Mon Sep 17 00:00:00 2001 From: Corbin Date: Sun, 6 Feb 2022 15:16:27 -0800 Subject: [PATCH] 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. --- .../servers/monitoring/prometheus/default.nix | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/pkgs/servers/monitoring/prometheus/default.nix b/pkgs/servers/monitoring/prometheus/default.nix index 806be646fa05..25053e837949 100644 --- a/pkgs/servers/monitoring/prometheus/default.nix +++ b/pkgs/servers/monitoring/prometheus/default.nix @@ -11,10 +11,22 @@ , fetchpatch , enableAWS ? true , enableAzure ? true +, enableConsul ? true , enableDigitalOcean ? true +, enableEureka ? true , enableGCE ? true +, enableHetzner ? true , enableKubernetes ? true , enableLinode ? true +, enableMarathon ? true +, enableMoby ? true +, enableOpenstack ? true +, enablePuppetDB ? true +, enableScaleway ? true +, enableTriton ? true +, enableUyuni ? true +, enableXDS ? true +, enableZookeeper ? true }: let @@ -104,14 +116,38 @@ buildGoModule rec { "sed -i -e '/register aws/d' discovery/install/install.go"} ${lib.optionalString (!enableAzure) "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) "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) "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) "sed -i -e '/register kubernetes/d' discovery/install/install.go"} ${lib.optionalString (!enableLinode) "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" ];