metropolis: implement Metrics Service
This is the first pass at a Metrics Service. It currently consists of an
HTTP reverse proxy which authenticates incoming connections using the
Cluster CA and certificates, and passes these connections over to a
locally running node_exporter.
In the future more exporters will be added, and we will likely also run
our own exporter for Metropolis-specific metrics.
Change-Id: Ibab52aa303965dd7d975f5035f411d1c56ad73e6
Reviewed-on: https://review.monogon.dev/c/monogon/+/1816
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/node/core/metrics/BUILD.bazel b/metropolis/node/core/metrics/BUILD.bazel
new file mode 100644
index 0000000..da69068
--- /dev/null
+++ b/metropolis/node/core/metrics/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "metrics",
+ srcs = [
+ "exporters.go",
+ "metrics.go",
+ ],
+ importpath = "source.monogon.dev/metropolis/node/core/metrics",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//metropolis/node",
+ "//metropolis/node/core/identity",
+ "//metropolis/pkg/logtree",
+ "//metropolis/pkg/supervisor",
+ ],
+)
+
+go_test(
+ name = "metrics_test",
+ srcs = ["metrics_test.go"],
+ data = [
+ # keep
+ "//metropolis/node/core/metrics/fake_exporter",
+ ],
+ embed = [":metrics"],
+ deps = [
+ "//metropolis/cli/pkg/datafile",
+ "//metropolis/node",
+ "//metropolis/node/core/rpc",
+ "//metropolis/pkg/supervisor",
+ "//metropolis/test/util",
+ ],
+)