about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorYt <raphael@megzari.com>2024-05-15 23:21:48 +0000
committerGitHub <noreply@github.com>2024-05-15 23:21:48 +0000
commitc8a9664fac0dba8bdc94e9ee73d4056f006e9675 (patch)
tree4704dbd2931db97763bb58ae9291e0935bf216f8 /nixos
parenta25ddda75afb92d1004a0c052b5f7f7967036ad7 (diff)
parentc97e5f8d17886d0f7e71acfc1d69ae98353657cd (diff)
Merge pull request #311790 from jpds/vector-test-metrics
nixos/vector: Added Prometheus exporter integration to tests
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/vector.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/nixos/tests/vector.nix b/nixos/tests/vector.nix
index a55eb4e012c5b..9c0d7e84fab33 100644
--- a/nixos/tests/vector.nix
+++ b/nixos/tests/vector.nix
@@ -14,15 +14,27 @@ with pkgs.lib;
         enable = true;
         journaldAccess = true;
         settings = {
-          sources.journald.type = "journald";
+          sources = {
+            journald.type = "journald";
+
+            vector_metrics.type = "internal_metrics";
+
+            vector_logs.type = "internal_logs";
+          };
 
           sinks = {
             file = {
               type = "file";
-              inputs = [ "journald" ];
+              inputs = [ "journald" "vector_logs" ];
               path = "/var/lib/vector/logs.log";
               encoding = { codec = "json"; };
             };
+
+            prometheus_exporter = {
+              type = "prometheus_exporter";
+              inputs = [ "vector_metrics" ];
+              address = "[::]:9598";
+            };
           };
         };
       };
@@ -31,6 +43,10 @@ with pkgs.lib;
     # ensure vector is forwarding the messages appropriately
     testScript = ''
       machine.wait_for_unit("vector.service")
+      machine.wait_for_open_port(9598)
+      machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_build_info")
+      machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_component_received_bytes_total | grep journald")
+      machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_utilization | grep prometheus_exporter")
       machine.wait_for_file("/var/lib/vector/logs.log")
     '';
   };