From 8143d05fe67ccb652b322f7658dfe6bc37c3b478 Mon Sep 17 00:00:00 2001 From: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com> Date: Sat, 14 Nov 2026 07:12:26 -0800 Subject: [PATCH 1/3] Use neutral host aliases in fixtures Known host slugs now come only from the overlay's host list, so the built-in list is gone and a query host that is valid in shape but absent from the overlay is refused as an unknown host. Tests pin both directions: an absent slug exits as a usage error, and a mapped slug answers. The fixtures, goldens and tests use neutral host aliases, which also lines them up with the document set re-vendored here. The document set is a byte-for-byte copy of the ten documents at the recorded documents commit; the schema bytes stay at their earlier pin because the difference between the two is a rename. The source note records both commits and what waits for the next phase. Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com> --- internal/config/config_test.go | 30 +- internal/promclient/promclient.go | 13 +- internal/promclient/promclient_test.go | 57 ++- .../promclient/testdata/prom/query-plain.json | 4 +- .../testdata/prom/query-series-cap.json | 402 +++++++++--------- .../testdata/prom/query-special-values.json | 6 +- .../testdata/prom/query-warnings.json | 2 +- .../testdata/prom/targets-mixed.json | 14 +- internal/schematest/schematest_test.go | 8 +- internal/sources/sources_test.go | 4 +- .../invalid/backend-vantage-not-a-slug.yaml | 2 +- testdata/config/invalid/unknown-key.yaml | 2 +- testdata/config/valid/vantage.yaml | 2 +- .../overlay/invalid/host-empty-instances.yaml | 2 +- .../overlay/invalid/host-instance-path.yaml | 2 +- testdata/overlay/invalid/unknown-key.yaml | 2 +- testdata/overlay/valid/hosts.yaml | 8 +- testdata/query/invalid/missing-value.json | 4 +- testdata/query/invalid/name-case.json | 2 +- testdata/query/invalid/numeric-value.json | 4 +- testdata/query/invalid/value-address.json | 4 +- testdata/query/invalid/value-name.json | 6 +- testdata/query/invalid/value-url.json | 4 +- testdata/query/valid/all-hosts.json | 2 +- testdata/query/valid/one-host.json | 6 +- testdata/query/valid/special-values.json | 14 +- testdata/simplex/SOURCE | 8 +- testdata/simplex/blind/document.json | 10 +- testdata/simplex/both-prom-down/document.json | 10 +- .../expected-dark-timeout/document.json | 6 +- testdata/simplex/expired-hold/document.json | 6 +- testdata/simplex/green/document.json | 18 +- testdata/simplex/held-and-down/document.json | 6 +- testdata/simplex/held/document.json | 6 +- testdata/simplex/one-prom-down/document.json | 10 +- testdata/simplex/path-override/document.json | 10 +- testdata/simplex/prom-not-ready/document.json | 10 +- testdata/sources/valid/backends.json | 2 +- .../summary/augur-unavailable/document.json | 8 +- testdata/summary/grafana-down/document.json | 8 +- .../summary/scry-unobserved/document.json | 8 +- testdata/summary/signal-present/document.json | 8 +- testdata/summary/simplex-green/document.json | 8 +- .../summary/simplex-stale-green/document.json | 8 +- .../simplex-yellow-augur-red/document.json | 6 +- testdata/summary/vantage-blind/document.json | 6 +- testdata/targets/invalid/health-case.json | 4 +- testdata/targets/invalid/host-case.json | 4 +- testdata/targets/invalid/job-address.json | 4 +- testdata/targets/valid/empty.json | 2 +- testdata/targets/valid/mixed.json | 4 +- 51 files changed, 399 insertions(+), 387 deletions(-) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 9a6119b..8309328 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -345,27 +345,27 @@ backends: - id: prom address: http://prom.example.invalid:9090 hosts: - - slug: castle - instances: [castle.example.invalid:9100] - - slug: castle - instances: [castle.example.invalid:9101] + - slug: core + instances: [core.example.invalid:9100] + - slug: core + instances: [core.example.invalid:9101] `, exitcode.Usage}, {"instance claimed twice", `apiVersion: vigil.overlay/v0 backends: - id: prom address: http://prom.example.invalid:9090 hosts: - - slug: castle - instances: [castle.example.invalid:9100] - - slug: tower - instances: [castle.example.invalid:9100] + - slug: core + instances: [core.example.invalid:9100] + - slug: spoke + instances: [core.example.invalid:9100] `, exitcode.Usage}, {"no instances", `apiVersion: vigil.overlay/v0 backends: - id: prom address: http://prom.example.invalid:9090 hosts: - - slug: castle + - slug: core instances: [] `, exitcode.Usage}, {"instance is a path", `apiVersion: vigil.overlay/v0 @@ -373,7 +373,7 @@ backends: - id: prom address: http://prom.example.invalid:9090 hosts: - - slug: castle + - slug: core instances: ["/etc/passwd"] `, exitcode.Usage}, } @@ -398,7 +398,7 @@ func TestBind(t *testing.T) { cfg, err := config.Load(writeFile(t, dir, "c.yaml", minimal+`backends: - id: prom kind: prom - vantage: lathe + vantage: lab queries: - name: q backend: prom @@ -407,7 +407,7 @@ queries: if err != nil { t.Fatalf("load config: %v", err) } - if b, ok := cfg.Backend("prom"); !ok || b.Vantage != "lathe" { + if b, ok := cfg.Backend("prom"); !ok || b.Vantage != "lab" { t.Fatalf("backend vantage = %+v", b) } @@ -416,8 +416,8 @@ backends: - id: prom address: http://prom.example.invalid:9090 hosts: - - slug: castle - instances: [castle.example.invalid:9100] + - slug: core + instances: [core.example.invalid:9100] `)) if err != nil { t.Fatalf("load overlay: %v", err) @@ -425,7 +425,7 @@ hosts: if err := good.Bind(cfg); err != nil { t.Fatalf("bind: %v", err) } - if slug, ok := good.SlugFor("castle.example.invalid:9100"); !ok || slug != "castle" { + if slug, ok := good.SlugFor("core.example.invalid:9100"); !ok || slug != "core" { t.Fatalf("slug = %q, %v", slug, ok) } if addr, ok := good.Address("prom"); !ok || addr != "http://prom.example.invalid:9090" { diff --git a/internal/promclient/promclient.go b/internal/promclient/promclient.go index 43e2d0a..9adca60 100644 --- a/internal/promclient/promclient.go +++ b/internal/promclient/promclient.go @@ -46,10 +46,6 @@ const ( redacted = "redacted" ) -// PublicSlugs are the six slugs the product publishes. A --host is accepted for -// one of these even when the overlay does not map it. -var PublicSlugs = []string{"castle", "tower", "citadel", "apiary", "lathe", "box"} - var ( slugPattern = regexp.MustCompile(`^[a-z][a-z0-9-]{0,31}$`) jobPattern = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,63}$`) @@ -347,16 +343,13 @@ func healthWord(h string) string { } } -// knownHost accepts a slug the overlay maps or one of the public slugs. +// knownHost accepts only a slug the overlay maps. The product keeps no built-in +// list: an operator's overlay is the one place a host is named, so a slug that +// is valid in shape but absent from it is an unknown host, not a public one. func knownHost(ov *config.Overlay, host string) bool { if !slugPattern.MatchString(host) { return false } - for _, slug := range PublicSlugs { - if slug == host { - return true - } - } for _, h := range ov.Hosts { if h.Slug == host { return true diff --git a/internal/promclient/promclient_test.go b/internal/promclient/promclient_test.go index 4c4aab0..4aad3ae 100644 --- a/internal/promclient/promclient_test.go +++ b/internal/promclient/promclient_test.go @@ -81,7 +81,7 @@ func fixtureConfig(t *testing.T, base string) (*config.Config, *config.Overlay) cfg := &config.Config{ APIVersion: config.ConfigMajor, Listen: config.DefaultListen, - Backends: []config.Backend{{ID: id, Kind: "prom", Vantage: "lathe"}}, + Backends: []config.Backend{{ID: id, Kind: "prom", Vantage: "lab"}}, Queries: []config.Query{ {Name: "up_by_host", Backend: id, Expr: `up{instance="{{.host}}"}`, Timeout: "5s", MaxSeries: 200}, {Name: "up_all", Backend: id, Expr: "up", Timeout: "5s", MaxSeries: 200}, @@ -92,7 +92,9 @@ func fixtureConfig(t *testing.T, base string) (*config.Config, *config.Overlay) APIVersion: config.OverlayMajor, Backends: []config.OverlayBackend{{ID: id, Address: base}}, Hosts: []config.OverlayHost{ - {Slug: "castle", Instances: []string{"castle.example.invalid:9100"}}, + {Slug: "core", Instances: []string{"core.example.invalid:9100"}}, + {Slug: "spoke", Instances: []string{"spoke.example.invalid:9100"}}, + {Slug: "edge", Instances: []string{"edge.example.invalid:9090"}}, }, } return cfg, ov @@ -120,7 +122,7 @@ func TestTargetsMapping(t *testing.T) { if *path != "/api/v1/targets" { t.Errorf("path = %q", *path) } - if doc.APIVersion != promclient.TargetsVersion || doc.Backend != backendID(t, "") || doc.Vantage != "lathe" { + if doc.APIVersion != promclient.TargetsVersion || doc.Backend != backendID(t, "") || doc.Vantage != "lab" { t.Errorf("document header = %+v", doc) } if doc.GeneratedAt != "2026-11-14T09:00:00Z" { @@ -128,9 +130,9 @@ func TestTargetsMapping(t *testing.T) { } // Rows sort by host, then job, then health. want := []promclient.Target{ - {Host: "box", Job: "node", Health: "unknown", LastScrape: nil}, - {Host: "castle", Job: "node", Health: "up", LastScrape: ptr("2026-11-14T09:00:00Z")}, - {Host: "tower", Job: "redacted", Health: "down", LastScrape: ptr("2026-11-14T09:00:00Z")}, + {Host: "core", Job: "node", Health: "up", LastScrape: ptr("2026-11-14T09:00:00Z")}, + {Host: "edge", Job: "node", Health: "unknown", LastScrape: nil}, + {Host: "spoke", Job: "redacted", Health: "down", LastScrape: ptr("2026-11-14T09:00:00Z")}, } if len(doc.Targets) != len(want) { t.Fatalf("targets = %+v", doc.Targets) @@ -148,11 +150,11 @@ func TestTargetsMapping(t *testing.T) { // A known slug keeps its own value, so a relabelled backend row is not a // wall of unmapped entries. for _, row := range doc.Targets { - if row.Host == "castle" { + if row.Host == "core" { return } } - t.Error("the castle row is missing") + t.Error("the core row is missing") validateAgainst(t, "vigil.targets.v0.schema.json", doc) } @@ -164,9 +166,9 @@ func TestTargetsMappingRules(t *testing.T) { planted := []string{ strings.Join([]string{"100", "64", "12", "34"}, "."), strings.Join([]string{"192", "168", "1", "20"}, "."), - strings.Join([]string{"castle", "ts", "net"}, "."), + strings.Join([]string{"core", "ts", "net"}, "."), } - addressInstance := strings.Join([]string{"castle", "example", "invalid"}, ".") + ":9100" + addressInstance := strings.Join([]string{"core", "example", "invalid"}, ".") + ":9100" body := `{"status":"success","data":{"activeTargets":[` + `{"labels":{"instance":"` + addressInstance + `","job":"node"},"health":"up"},` + `{"labels":{"instance":"edge-7","job":"node"},"health":"up"},` + @@ -184,8 +186,8 @@ func TestTargetsMappingRules(t *testing.T) { } // The overlay maps the address-shaped instance; the rest are names we do // not publish, so they read as unmapped. - if doc.Targets[0].Host != "castle" { - t.Errorf("mapped instance = %q, want castle", doc.Targets[0].Host) + if doc.Targets[0].Host != "core" { + t.Errorf("mapped instance = %q, want core", doc.Targets[0].Host) } for _, row := range doc.Targets[1:] { if row.Host != "unmapped" { @@ -217,35 +219,50 @@ func TestQueryRules(t *testing.T) { t.Run("unexpected host", func(t *testing.T) { srv, _ := serveFixture(t, "query-plain.json") cfg, ov := fixtureConfig(t, srv.URL) - _, err := promclient.Query(context.Background(), cfg, ov, "up_all", "tower", fixedNow) + _, err := promclient.Query(context.Background(), cfg, ov, "up_all", "spoke", fixedNow) wantExit, wantCode := code(t, err) if wantExit != exitcode.Usage || wantCode != "unexpected_host" { t.Fatalf("got %d/%s", wantExit, wantCode) } }) - t.Run("unknown host", func(t *testing.T) { + t.Run("host outside the overlay", func(t *testing.T) { + // "depot" is valid in shape and the product once accepted it without an + // overlay entry. The overlay is the only place a host is named, so it is + // unknown here. srv, _ := serveFixture(t, "query-plain.json") cfg, ov := fixtureConfig(t, srv.URL) - _, err := promclient.Query(context.Background(), cfg, ov, "up_by_host", "nowhere", fixedNow) + _, err := promclient.Query(context.Background(), cfg, ov, "up_by_host", "depot", fixedNow) wantExit, wantCode := code(t, err) if wantExit != exitcode.Usage || wantCode != "unknown_host" { t.Fatalf("got %d/%s", wantExit, wantCode) } }) + t.Run("overlay host answers", func(t *testing.T) { + srv, _ := serveFixture(t, "query-plain.json") + cfg, ov := fixtureConfig(t, srv.URL) + doc, err := promclient.Query(context.Background(), cfg, ov, "up_by_host", "spoke", fixedNow) + if err != nil { + t.Fatalf("overlay host refused: %v", err) + } + if doc.Host != "spoke" { + t.Fatalf("host = %q", doc.Host) + } + validateAgainst(t, "vigil.query.v0.schema.json", doc) + }) t.Run("plain answer", func(t *testing.T) { srv, path := serveFixture(t, "query-plain.json") cfg, ov := fixtureConfig(t, srv.URL) - doc, err := promclient.Query(context.Background(), cfg, ov, "up_by_host", "castle", fixedNow) + doc, err := promclient.Query(context.Background(), cfg, ov, "up_by_host", "core", fixedNow) if err != nil { t.Fatalf("query: %v", err) } if *path != "/api/v1/query" { t.Errorf("path = %q", *path) } - if doc.Host != "castle" || doc.Name != "up_by_host" { + if doc.Host != "core" || doc.Name != "up_by_host" { t.Errorf("header = %+v", doc) } - if len(doc.Series) != 2 || doc.Series[0].Host != "castle" || doc.Series[1].Host != "tower" { + if len(doc.Series) != 2 || doc.Series[0].Host != "core" || doc.Series[1].Host != "spoke" { t.Errorf("series = %+v", doc.Series) } validateAgainst(t, "vigil.query.v0.schema.json", doc) @@ -265,7 +282,7 @@ func TestQueryRules(t *testing.T) { }) t.Run("dotted sample value", func(t *testing.T) { decimal := "1" + "." + "5e-3" - srv := serveBody(t, `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"instance":"tower"},"value":[1763107200,"`+decimal+`"]}]}}`) + srv := serveBody(t, `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"instance":"spoke"},"value":[1763107200,"`+decimal+`"]}]}}`) cfg, ov := fixtureConfig(t, srv.URL) doc, err := promclient.Query(context.Background(), cfg, ov, "up_all", "", fixedNow) if err != nil { @@ -278,7 +295,7 @@ func TestQueryRules(t *testing.T) { }) t.Run("value that is not a number", func(t *testing.T) { garbage := strings.Join([]string{"1", "2", "3"}, ".") - srv := serveBody(t, `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"instance":"tower"},"value":[1763107200,"`+garbage+`"]}]}}`) + srv := serveBody(t, `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"instance":"spoke"},"value":[1763107200,"`+garbage+`"]}]}}`) cfg, ov := fixtureConfig(t, srv.URL) _, err := promclient.Query(context.Background(), cfg, ov, "up_all", "", fixedNow) if exit, got := code(t, err); exit != exitcode.Unavailable || got != reasons.HTTPStatus { diff --git a/internal/promclient/testdata/prom/query-plain.json b/internal/promclient/testdata/prom/query-plain.json index 6826909..caac0d2 100644 --- a/internal/promclient/testdata/prom/query-plain.json +++ b/internal/promclient/testdata/prom/query-plain.json @@ -5,7 +5,7 @@ "result": [ { "metric": { - "instance": "castle", + "instance": "core", "job": "node" }, "value": [ @@ -15,7 +15,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ diff --git a/internal/promclient/testdata/prom/query-series-cap.json b/internal/promclient/testdata/prom/query-series-cap.json index 61a6d2a..09bd15f 100644 --- a/internal/promclient/testdata/prom/query-series-cap.json +++ b/internal/promclient/testdata/prom/query-series-cap.json @@ -5,7 +5,7 @@ "result": [ { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -15,7 +15,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -25,7 +25,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -35,7 +35,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -45,7 +45,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -55,7 +55,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -65,7 +65,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -75,7 +75,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -85,7 +85,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -95,7 +95,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -105,7 +105,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -115,7 +115,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -125,7 +125,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -135,7 +135,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -145,7 +145,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -155,7 +155,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -165,7 +165,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -175,7 +175,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -185,7 +185,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -195,7 +195,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -205,7 +205,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -215,7 +215,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -225,7 +225,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -235,7 +235,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -245,7 +245,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -255,7 +255,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -265,7 +265,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -275,7 +275,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -285,7 +285,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -295,7 +295,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -305,7 +305,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -315,7 +315,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -325,7 +325,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -335,7 +335,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -345,7 +345,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -355,7 +355,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -365,7 +365,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -375,7 +375,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -385,7 +385,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -395,7 +395,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -405,7 +405,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -415,7 +415,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -425,7 +425,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -435,7 +435,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -445,7 +445,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -455,7 +455,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -465,7 +465,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -475,7 +475,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -485,7 +485,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -495,7 +495,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -505,7 +505,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -515,7 +515,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -525,7 +525,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -535,7 +535,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -545,7 +545,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -555,7 +555,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -565,7 +565,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -575,7 +575,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -585,7 +585,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -595,7 +595,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -605,7 +605,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -615,7 +615,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -625,7 +625,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -635,7 +635,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -645,7 +645,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -655,7 +655,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -665,7 +665,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -675,7 +675,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -685,7 +685,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -695,7 +695,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -705,7 +705,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -715,7 +715,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -725,7 +725,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -735,7 +735,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -745,7 +745,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -755,7 +755,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -765,7 +765,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -775,7 +775,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -785,7 +785,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -795,7 +795,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -805,7 +805,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -815,7 +815,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -825,7 +825,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -835,7 +835,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -845,7 +845,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -855,7 +855,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -865,7 +865,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -875,7 +875,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -885,7 +885,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -895,7 +895,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -905,7 +905,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -915,7 +915,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -925,7 +925,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -935,7 +935,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -945,7 +945,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -955,7 +955,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -965,7 +965,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -975,7 +975,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -985,7 +985,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -995,7 +995,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1005,7 +1005,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1015,7 +1015,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1025,7 +1025,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1035,7 +1035,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1045,7 +1045,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1055,7 +1055,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1065,7 +1065,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1075,7 +1075,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1085,7 +1085,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1095,7 +1095,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1105,7 +1105,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1115,7 +1115,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1125,7 +1125,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1135,7 +1135,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1145,7 +1145,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1155,7 +1155,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1165,7 +1165,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1175,7 +1175,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1185,7 +1185,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1195,7 +1195,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1205,7 +1205,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1215,7 +1215,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1225,7 +1225,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1235,7 +1235,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1245,7 +1245,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1255,7 +1255,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1265,7 +1265,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1275,7 +1275,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1285,7 +1285,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1295,7 +1295,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1305,7 +1305,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1315,7 +1315,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1325,7 +1325,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1335,7 +1335,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1345,7 +1345,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1355,7 +1355,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1365,7 +1365,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1375,7 +1375,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1385,7 +1385,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1395,7 +1395,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1405,7 +1405,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1415,7 +1415,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1425,7 +1425,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1435,7 +1435,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1445,7 +1445,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1455,7 +1455,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1465,7 +1465,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1475,7 +1475,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1485,7 +1485,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1495,7 +1495,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1505,7 +1505,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1515,7 +1515,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1525,7 +1525,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1535,7 +1535,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1545,7 +1545,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1555,7 +1555,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1565,7 +1565,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1575,7 +1575,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1585,7 +1585,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1595,7 +1595,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1605,7 +1605,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1615,7 +1615,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1625,7 +1625,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1635,7 +1635,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1645,7 +1645,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1655,7 +1655,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1665,7 +1665,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1675,7 +1675,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1685,7 +1685,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1695,7 +1695,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1705,7 +1705,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1715,7 +1715,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1725,7 +1725,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1735,7 +1735,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1745,7 +1745,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1755,7 +1755,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1765,7 +1765,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1775,7 +1775,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1785,7 +1785,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1795,7 +1795,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1805,7 +1805,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1815,7 +1815,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1825,7 +1825,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1835,7 +1835,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1845,7 +1845,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1855,7 +1855,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1865,7 +1865,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1875,7 +1875,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1885,7 +1885,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1895,7 +1895,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1905,7 +1905,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1915,7 +1915,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1925,7 +1925,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1935,7 +1935,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1945,7 +1945,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1955,7 +1955,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1965,7 +1965,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1975,7 +1975,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1985,7 +1985,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -1995,7 +1995,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ @@ -2005,7 +2005,7 @@ }, { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ diff --git a/internal/promclient/testdata/prom/query-special-values.json b/internal/promclient/testdata/prom/query-special-values.json index 15275ea..0d441de 100644 --- a/internal/promclient/testdata/prom/query-special-values.json +++ b/internal/promclient/testdata/prom/query-special-values.json @@ -5,7 +5,7 @@ "result": [ { "metric": { - "instance": "tower" + "instance": "spoke" }, "value": [ 1763107200, @@ -14,7 +14,7 @@ }, { "metric": { - "instance": "tower" + "instance": "spoke" }, "value": [ 1763107200, @@ -23,7 +23,7 @@ }, { "metric": { - "instance": "tower" + "instance": "spoke" }, "value": [ 1763107200, diff --git a/internal/promclient/testdata/prom/query-warnings.json b/internal/promclient/testdata/prom/query-warnings.json index 8837114..312f034 100644 --- a/internal/promclient/testdata/prom/query-warnings.json +++ b/internal/promclient/testdata/prom/query-warnings.json @@ -8,7 +8,7 @@ "result": [ { "metric": { - "instance": "tower", + "instance": "spoke", "job": "node" }, "value": [ diff --git a/internal/promclient/testdata/prom/targets-mixed.json b/internal/promclient/testdata/prom/targets-mixed.json index 7df7575..58d16fa 100644 --- a/internal/promclient/testdata/prom/targets-mixed.json +++ b/internal/promclient/testdata/prom/targets-mixed.json @@ -4,23 +4,23 @@ "activeTargets": [ { "labels": { - "instance": "castle", + "instance": "core", "job": "node" }, - "scrapeUrl": "http://castle.example.invalid:9100/metrics", + "scrapeUrl": "http://core.example.invalid:9100/metrics", "lastError": "", "discoveredLabels": { - "__address__": "castle.example.invalid:9100" + "__address__": "core.example.invalid:9100" }, "health": "up", "lastScrape": "2026-11-14T09:00:00Z" }, { "labels": { - "instance": "tower", + "instance": "spoke", "job": "Node Exporter" }, - "scrapeUrl": "http://tower.example.invalid:9100/metrics", + "scrapeUrl": "http://spoke.example.invalid:9100/metrics", "lastError": "", "discoveredLabels": {}, "health": "down", @@ -28,10 +28,10 @@ }, { "labels": { - "instance": "box", + "instance": "edge", "job": "node" }, - "scrapeUrl": "http://box.example.invalid:9090/metrics", + "scrapeUrl": "http://edge.example.invalid:9090/metrics", "lastError": "dial tcp: connection refused", "discoveredLabels": {}, "health": "unknown", diff --git a/internal/schematest/schematest_test.go b/internal/schematest/schematest_test.go index ebb7e77..abb61ab 100644 --- a/internal/schematest/schematest_test.go +++ b/internal/schematest/schematest_test.go @@ -581,10 +581,10 @@ func TestQueryValueShape(t *testing.T) { return map[string]any{ "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", - "series": []any{map[string]any{"host": "castle", "value": value}}, + "series": []any{map[string]any{"host": "core", "value": value}}, } } good := []string{"0", "1", "-0.5", "1.5e-3", "2E+10", "NaN", "+Inf", "-Inf"} @@ -595,13 +595,13 @@ func TestQueryValueShape(t *testing.T) { } bad := []string{ "http://prom.example.invalid:9090", - "castle", + "core", "127.0.0.1", "1.2.3", "1,5", "", strings.Join([]string{"100", "64", "0", "1"}, "."), - strings.Join([]string{"castle", "ts", "net"}, "."), + strings.Join([]string{"core", "ts", "net"}, "."), } for _, v := range bad { if err := sch.Validate(doc(v)); err == nil { diff --git a/internal/sources/sources_test.go b/internal/sources/sources_test.go index 6063b1f..bfe4bcb 100644 --- a/internal/sources/sources_test.go +++ b/internal/sources/sources_test.go @@ -73,7 +73,7 @@ func cfgFor(t *testing.T, promURL, grafanaURL string) (*config.Config, *config.O APIVersion: config.ConfigMajor, Listen: config.DefaultListen, Backends: []config.Backend{ - {ID: promID, Kind: "prom", Vantage: "lathe"}, + {ID: promID, Kind: "prom", Vantage: "lab"}, {ID: grafanaID, Kind: "grafana"}, }, } @@ -108,7 +108,7 @@ func TestSourcesRows(t *testing.T) { t.Errorf("row %q carries a last_ok, but V1 keeps no state", row.ID) } } - if doc.Sources[0].Vantage != "lathe" || doc.Sources[1].Vantage != "" { + if doc.Sources[0].Vantage != "lab" || doc.Sources[1].Vantage != "" { t.Errorf("vantage rows = %q/%q", doc.Sources[0].Vantage, doc.Sources[1].Vantage) } validate(t, doc) diff --git a/testdata/config/invalid/backend-vantage-not-a-slug.yaml b/testdata/config/invalid/backend-vantage-not-a-slug.yaml index dd7ba51..5c06799 100644 --- a/testdata/config/invalid/backend-vantage-not-a-slug.yaml +++ b/testdata/config/invalid/backend-vantage-not-a-slug.yaml @@ -2,7 +2,7 @@ apiVersion: vigil.config/v0 backends: - id: prom kind: prom - vantage: Lathe Two + vantage: Lab Two authorities: - id: simplex path_ref: env:VIGIL_SIMPLEX_PATH diff --git a/testdata/config/invalid/unknown-key.yaml b/testdata/config/invalid/unknown-key.yaml index cabc8e1..403ed67 100644 --- a/testdata/config/invalid/unknown-key.yaml +++ b/testdata/config/invalid/unknown-key.yaml @@ -1,5 +1,5 @@ apiVersion: vigil.config/v0 -vantage: lathe +vantage: lab authorities: - id: simplex path_ref: env:VIGIL_SIMPLEX_PATH diff --git a/testdata/config/valid/vantage.yaml b/testdata/config/valid/vantage.yaml index 535f3ea..8fd8cdc 100644 --- a/testdata/config/valid/vantage.yaml +++ b/testdata/config/valid/vantage.yaml @@ -2,7 +2,7 @@ apiVersion: vigil.config/v0 backends: - id: prom kind: prom - vantage: lathe + vantage: lab - id: grafana kind: grafana authorities: diff --git a/testdata/overlay/invalid/host-empty-instances.yaml b/testdata/overlay/invalid/host-empty-instances.yaml index 365e6df..1dfd6e3 100644 --- a/testdata/overlay/invalid/host-empty-instances.yaml +++ b/testdata/overlay/invalid/host-empty-instances.yaml @@ -3,5 +3,5 @@ backends: - id: prom address: http://prom.example.invalid:9090 hosts: - - slug: castle + - slug: core instances: [] diff --git a/testdata/overlay/invalid/host-instance-path.yaml b/testdata/overlay/invalid/host-instance-path.yaml index 9c61531..9c875ee 100644 --- a/testdata/overlay/invalid/host-instance-path.yaml +++ b/testdata/overlay/invalid/host-instance-path.yaml @@ -3,6 +3,6 @@ backends: - id: prom address: http://prom.example.invalid:9090 hosts: - - slug: castle + - slug: core instances: - /etc/passwd diff --git a/testdata/overlay/invalid/unknown-key.yaml b/testdata/overlay/invalid/unknown-key.yaml index 3dc7c89..bde09b8 100644 --- a/testdata/overlay/invalid/unknown-key.yaml +++ b/testdata/overlay/invalid/unknown-key.yaml @@ -1,5 +1,5 @@ apiVersion: vigil.overlay/v0 -vantage: lathe +vantage: lab backends: - id: prom address: http://prom.example.invalid:9090 diff --git a/testdata/overlay/valid/hosts.yaml b/testdata/overlay/valid/hosts.yaml index c1a163b..cf18197 100644 --- a/testdata/overlay/valid/hosts.yaml +++ b/testdata/overlay/valid/hosts.yaml @@ -5,9 +5,9 @@ backends: - id: grafana address: http://grafana.example.invalid:3000 hosts: - - slug: castle + - slug: core instances: - - castle.example.invalid:9100 - - slug: tower + - core.example.invalid:9100 + - slug: spoke instances: - - tower.example.invalid:9100 + - spoke.example.invalid:9100 diff --git a/testdata/query/invalid/missing-value.json b/testdata/query/invalid/missing-value.json index 24a8d38..891f10f 100644 --- a/testdata/query/invalid/missing-value.json +++ b/testdata/query/invalid/missing-value.json @@ -1,12 +1,12 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", "series": [ { - "host": "castle" + "host": "core" } ] } diff --git a/testdata/query/invalid/name-case.json b/testdata/query/invalid/name-case.json index 680b080..6218f8d 100644 --- a/testdata/query/invalid/name-case.json +++ b/testdata/query/invalid/name-case.json @@ -1,7 +1,7 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "UpByHost", "evaluated_at": "2026-11-14T09:00:00Z", "series": [] diff --git a/testdata/query/invalid/numeric-value.json b/testdata/query/invalid/numeric-value.json index 51f8555..0faafef 100644 --- a/testdata/query/invalid/numeric-value.json +++ b/testdata/query/invalid/numeric-value.json @@ -1,12 +1,12 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", "series": [ { - "host": "castle", + "host": "core", "value": 1 } ] diff --git a/testdata/query/invalid/value-address.json b/testdata/query/invalid/value-address.json index 150bede..368a10d 100644 --- a/testdata/query/invalid/value-address.json +++ b/testdata/query/invalid/value-address.json @@ -1,12 +1,12 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", "series": [ { - "host": "castle", + "host": "core", "value": "127.0.0.1" } ] diff --git a/testdata/query/invalid/value-name.json b/testdata/query/invalid/value-name.json index 59cb55f..d0602c7 100644 --- a/testdata/query/invalid/value-name.json +++ b/testdata/query/invalid/value-name.json @@ -1,13 +1,13 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", "series": [ { - "host": "castle", - "value": "castle" + "host": "core", + "value": "core" } ] } diff --git a/testdata/query/invalid/value-url.json b/testdata/query/invalid/value-url.json index af7d45a..95a5d03 100644 --- a/testdata/query/invalid/value-url.json +++ b/testdata/query/invalid/value-url.json @@ -1,12 +1,12 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", "series": [ { - "host": "castle", + "host": "core", "value": "http://prom.example.invalid:9090" } ] diff --git a/testdata/query/valid/all-hosts.json b/testdata/query/valid/all-hosts.json index 22b07f0..9cfd137 100644 --- a/testdata/query/valid/all-hosts.json +++ b/testdata/query/valid/all-hosts.json @@ -1,7 +1,7 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", "series": [] diff --git a/testdata/query/valid/one-host.json b/testdata/query/valid/one-host.json index 2a98aa6..8a8d189 100644 --- a/testdata/query/valid/one-host.json +++ b/testdata/query/valid/one-host.json @@ -1,13 +1,13 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", - "host": "castle", + "host": "core", "evaluated_at": "2026-11-14T09:00:00Z", "series": [ { - "host": "castle", + "host": "core", "job": "node", "value": "1" } diff --git a/testdata/query/valid/special-values.json b/testdata/query/valid/special-values.json index 0eec69f..d66162a 100644 --- a/testdata/query/valid/special-values.json +++ b/testdata/query/valid/special-values.json @@ -1,32 +1,32 @@ { "apiVersion": "vigil.query/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "name": "up_by_host", "evaluated_at": "2026-11-14T09:00:00Z", "series": [ { - "host": "castle", + "host": "core", "value": "1" }, { - "host": "tower", + "host": "spoke", "value": "-0.5" }, { - "host": "lathe", + "host": "lab", "value": "1.5e-3" }, { - "host": "box", + "host": "edge", "value": "NaN" }, { - "host": "apiary", + "host": "annex", "value": "+Inf" }, { - "host": "citadel", + "host": "depot", "value": "-Inf" } ] diff --git a/testdata/simplex/SOURCE b/testdata/simplex/SOURCE index 4dd104b..af379b5 100644 --- a/testdata/simplex/SOURCE +++ b/testdata/simplex/SOURCE @@ -1,9 +1,11 @@ repo: Hedronite/simplex -commit: 503268433bdb716cc79a0a62a955c1136a1502ce -phase: S1 exit (simplex check --json writes a conformant document to a file) +documents_commit: 21ad602cd8a9b4e13ea326103500c052b4b96710 +documents_note: byte-for-byte copies of the ten documents below. Between the two commits Simplex renamed its example host slugs; the change is a rename only, so these documents still validate against the schema pinned next. +schema_commit: 503268433bdb716cc79a0a62a955c1136a1502ce vendored: - schema/simplex.probe.v0.schema.json - testdata/simplex//document.json - testdata/simplex//exit excluded: Simplex configs and overlays (config.yaml, private.yaml) -note: byte-for-byte copies. config-error (exit 3) and io-error (exit 4) ship no document, which is "no file written" and reaches Vigil as unavailable. +deferred_to_v2: the newer reason codes and the enrichment case land with the V2 re-vendor from v0.1.0. +note: config-error (exit 3) and io-error (exit 4) ship no document, which is "no file written" and reaches Vigil as unavailable. diff --git a/testdata/simplex/blind/document.json b/testdata/simplex/blind/document.json index b103018..d9086c8 100644 --- a/testdata/simplex/blind/document.json +++ b/testdata/simplex/blind/document.json @@ -1,17 +1,17 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "blind"}, + "vantage": {"id": "lab", "status": "blind"}, "overall": "RED", "hosts": [ - {"id": "box", "severity": "RED", "reasons": ["vantage_blind"]}, - {"id": "lathe", "severity": "RED", "reasons": ["vantage_blind"]} + {"id": "edge", "severity": "RED", "reasons": ["vantage_blind"]}, + {"id": "lab", "severity": "RED", "reasons": ["vantage_blind"]} ], "checks": [ - {"host": "box", "kind": "prom_up", "target": ":9090/-/ready", "result": "unknown", + {"host": "edge", "kind": "prom_up", "target": ":9090/-/ready", "result": "unknown", "severity": "RED", "expected": "light", "reasons": ["vantage_blind"]}, - {"host": "lathe", "kind": "prom_up", "target": ":9090/-/ready", "result": "unknown", + {"host": "lab", "kind": "prom_up", "target": ":9090/-/ready", "result": "unknown", "severity": "RED", "expected": "light", "reasons": ["vantage_blind"]} ] diff --git a/testdata/simplex/both-prom-down/document.json b/testdata/simplex/both-prom-down/document.json index 3811554..558056e 100644 --- a/testdata/simplex/both-prom-down/document.json +++ b/testdata/simplex/both-prom-down/document.json @@ -1,17 +1,17 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "RED", "hosts": [ - {"id": "box", "severity": "RED", "reasons": ["http_unexpected_status", "prom_pair_down", "unexpected_dark"]}, - {"id": "lathe", "severity": "RED", "reasons": ["http_unexpected_status", "prom_pair_down", "unexpected_dark"]} + {"id": "edge", "severity": "RED", "reasons": ["http_unexpected_status", "prom_pair_down", "unexpected_dark"]}, + {"id": "lab", "severity": "RED", "reasons": ["http_unexpected_status", "prom_pair_down", "unexpected_dark"]} ], "checks": [ - {"host": "box", "kind": "prom_up", "target": ":9090/-/ready", "result": "down", + {"host": "edge", "kind": "prom_up", "target": ":9090/-/ready", "result": "down", "severity": "RED", "expected": "light", "reasons": ["http_unexpected_status", "prom_pair_down", "unexpected_dark"]}, - {"host": "lathe", "kind": "prom_up", "target": ":9090/-/ready", "result": "down", + {"host": "lab", "kind": "prom_up", "target": ":9090/-/ready", "result": "down", "severity": "RED", "expected": "light", "reasons": ["http_unexpected_status", "prom_pair_down", "unexpected_dark"]} ] diff --git a/testdata/simplex/expected-dark-timeout/document.json b/testdata/simplex/expected-dark-timeout/document.json index f5e8fd0..d368308 100644 --- a/testdata/simplex/expected-dark-timeout/document.json +++ b/testdata/simplex/expected-dark-timeout/document.json @@ -1,13 +1,13 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "GREEN", "hosts": [ - {"id": "tower", "severity": "GREEN", "reasons": ["expected_dark", "tcp_connect_timeout"]} + {"id": "spoke", "severity": "GREEN", "reasons": ["expected_dark", "tcp_connect_timeout"]} ], "checks": [ - {"host": "tower", "kind": "kube_apiserver", "target": ":6443", "result": "unknown", + {"host": "spoke", "kind": "kube_apiserver", "target": ":6443", "result": "unknown", "severity": "GREEN", "expected": "dark", "reasons": ["expected_dark", "tcp_connect_timeout"]} ] diff --git a/testdata/simplex/expired-hold/document.json b/testdata/simplex/expired-hold/document.json index 4d9495e..5789caa 100644 --- a/testdata/simplex/expired-hold/document.json +++ b/testdata/simplex/expired-hold/document.json @@ -1,13 +1,13 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "YELLOW", "hosts": [ - {"id": "tower", "severity": "YELLOW", "reasons": ["probe_unknown", "tcp_connect_timeout"]} + {"id": "spoke", "severity": "YELLOW", "reasons": ["probe_unknown", "tcp_connect_timeout"]} ], "checks": [ - {"host": "tower", "kind": "ts_reach", "target": ":9100", "result": "unknown", + {"host": "spoke", "kind": "ts_reach", "target": ":9100", "result": "unknown", "severity": "YELLOW", "expected": "light", "reasons": ["probe_unknown", "tcp_connect_timeout"]} ] diff --git a/testdata/simplex/green/document.json b/testdata/simplex/green/document.json index fcceea5..f78a932 100644 --- a/testdata/simplex/green/document.json +++ b/testdata/simplex/green/document.json @@ -1,27 +1,27 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "ok"}, + "vantage": {"id": "lab", "status": "ok"}, "overall": "GREEN", "hosts": [ - {"id": "box", "severity": "GREEN", "reasons": []}, - {"id": "lathe", "severity": "GREEN", "reasons": []}, - {"id": "tower", "severity": "GREEN", "reasons": ["expected_dark", "tcp_connect_refused", "tcp_connect_ok"]} + {"id": "edge", "severity": "GREEN", "reasons": []}, + {"id": "lab", "severity": "GREEN", "reasons": []}, + {"id": "spoke", "severity": "GREEN", "reasons": ["expected_dark", "tcp_connect_refused", "tcp_connect_ok"]} ], "checks": [ - {"host": "box", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", + {"host": "edge", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", "severity": "GREEN", "expected": "light", "reasons": []}, - {"host": "lathe", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", + {"host": "lab", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", "severity": "GREEN", "expected": "light", "reasons": []}, - {"host": "tower", "kind": "kube_apiserver", "target": ":6443", "result": "down", + {"host": "spoke", "kind": "kube_apiserver", "target": ":6443", "result": "down", "severity": "GREEN", "expected": "dark", "reasons": ["expected_dark", "tcp_connect_refused"]}, - {"host": "tower", "kind": "node_exporter", "target": ":9100/metrics", "result": "up", + {"host": "spoke", "kind": "node_exporter", "target": ":9100/metrics", "result": "up", "severity": "GREEN", "expected": "light", "reasons": []}, - {"host": "tower", "kind": "ts_reach", "target": ":9100", "result": "up", + {"host": "spoke", "kind": "ts_reach", "target": ":9100", "result": "up", "severity": "GREEN", "expected": "light", "reasons": ["tcp_connect_ok"]} ] diff --git a/testdata/simplex/held-and-down/document.json b/testdata/simplex/held-and-down/document.json index 43078b9..6c3527b 100644 --- a/testdata/simplex/held-and-down/document.json +++ b/testdata/simplex/held-and-down/document.json @@ -1,13 +1,13 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "GREEN", "hosts": [ - {"id": "box", "severity": "GREEN", "reasons": ["held", "tcp_connect_refused"]} + {"id": "edge", "severity": "GREEN", "reasons": ["held", "tcp_connect_refused"]} ], "checks": [ - {"host": "box", "kind": "node_exporter", "target": ":9100/metrics", "result": "down", + {"host": "edge", "kind": "node_exporter", "target": ":9100/metrics", "result": "down", "severity": "GREEN", "expected": "light", "reasons": ["held", "tcp_connect_refused"]} ] diff --git a/testdata/simplex/held/document.json b/testdata/simplex/held/document.json index 84a353c..4f499aa 100644 --- a/testdata/simplex/held/document.json +++ b/testdata/simplex/held/document.json @@ -1,13 +1,13 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "GREEN", "hosts": [ - {"id": "tower", "severity": "GREEN", "reasons": ["held", "tcp_connect_ok"]} + {"id": "spoke", "severity": "GREEN", "reasons": ["held", "tcp_connect_ok"]} ], "checks": [ - {"host": "tower", "kind": "ts_reach", "target": ":9100", "result": "up", + {"host": "spoke", "kind": "ts_reach", "target": ":9100", "result": "up", "severity": "GREEN", "expected": "light", "reasons": ["held", "tcp_connect_ok"]} ] diff --git a/testdata/simplex/one-prom-down/document.json b/testdata/simplex/one-prom-down/document.json index 5a21136..cd7128e 100644 --- a/testdata/simplex/one-prom-down/document.json +++ b/testdata/simplex/one-prom-down/document.json @@ -1,17 +1,17 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "YELLOW", "hosts": [ - {"id": "box", "severity": "YELLOW", "reasons": ["http_unexpected_status", "prom_pair_degraded", "unexpected_dark"]}, - {"id": "lathe", "severity": "GREEN", "reasons": []} + {"id": "edge", "severity": "YELLOW", "reasons": ["http_unexpected_status", "prom_pair_degraded", "unexpected_dark"]}, + {"id": "lab", "severity": "GREEN", "reasons": []} ], "checks": [ - {"host": "box", "kind": "prom_up", "target": ":9090/-/ready", "result": "down", + {"host": "edge", "kind": "prom_up", "target": ":9090/-/ready", "result": "down", "severity": "YELLOW", "expected": "light", "reasons": ["http_unexpected_status", "prom_pair_degraded", "unexpected_dark"]}, - {"host": "lathe", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", + {"host": "lab", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", "severity": "GREEN", "expected": "light", "reasons": []} ] diff --git a/testdata/simplex/path-override/document.json b/testdata/simplex/path-override/document.json index ef033f4..1804b00 100644 --- a/testdata/simplex/path-override/document.json +++ b/testdata/simplex/path-override/document.json @@ -1,17 +1,17 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "GREEN", "hosts": [ - {"id": "box", "severity": "GREEN", "reasons": []}, - {"id": "lathe", "severity": "GREEN", "reasons": []} + {"id": "edge", "severity": "GREEN", "reasons": []}, + {"id": "lab", "severity": "GREEN", "reasons": []} ], "checks": [ - {"host": "box", "kind": "prom_up", "target": ":9090/metrics", "result": "up", + {"host": "edge", "kind": "prom_up", "target": ":9090/metrics", "result": "up", "severity": "GREEN", "expected": "light", "reasons": []}, - {"host": "lathe", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", + {"host": "lab", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", "severity": "GREEN", "expected": "light", "reasons": []} ] diff --git a/testdata/simplex/prom-not-ready/document.json b/testdata/simplex/prom-not-ready/document.json index f14e5e2..78ba2e3 100644 --- a/testdata/simplex/prom-not-ready/document.json +++ b/testdata/simplex/prom-not-ready/document.json @@ -1,17 +1,17 @@ { "apiVersion": "simplex.probe/v0", "generated_at": "2026-11-13T18:00:00Z", - "vantage": {"id": "lathe", "status": "unchecked"}, + "vantage": {"id": "lab", "status": "unchecked"}, "overall": "YELLOW", "hosts": [ - {"id": "box", "severity": "YELLOW", "reasons": ["prom_not_ready"]}, - {"id": "lathe", "severity": "GREEN", "reasons": []} + {"id": "edge", "severity": "YELLOW", "reasons": ["prom_not_ready"]}, + {"id": "lab", "severity": "GREEN", "reasons": []} ], "checks": [ - {"host": "box", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", + {"host": "edge", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", "severity": "YELLOW", "expected": "light", "reasons": ["prom_not_ready"]}, - {"host": "lathe", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", + {"host": "lab", "kind": "prom_up", "target": ":9090/-/ready", "result": "up", "severity": "GREEN", "expected": "light", "reasons": []} ] diff --git a/testdata/sources/valid/backends.json b/testdata/sources/valid/backends.json index fc987a8..7b950e7 100644 --- a/testdata/sources/valid/backends.json +++ b/testdata/sources/valid/backends.json @@ -8,7 +8,7 @@ "state": "ok", "observed_at": "2026-11-14T09:00:00Z", "last_ok": "2026-11-14T09:00:00Z", - "vantage": "lathe" + "vantage": "lab" }, { "id": "grafana", diff --git a/testdata/summary/augur-unavailable/document.json b/testdata/summary/augur-unavailable/document.json index 674fa84..475b671 100644 --- a/testdata/summary/augur-unavailable/document.json +++ b/testdata/summary/augur-unavailable/document.json @@ -21,24 +21,24 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "ok" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "tower", + "id": "spoke", "severity": "GREEN", "reasons": [ "expected_dark", diff --git a/testdata/summary/grafana-down/document.json b/testdata/summary/grafana-down/document.json index ca9c371..ab051dd 100644 --- a/testdata/summary/grafana-down/document.json +++ b/testdata/summary/grafana-down/document.json @@ -12,24 +12,24 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "ok" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "tower", + "id": "spoke", "severity": "GREEN", "reasons": [ "expected_dark", diff --git a/testdata/summary/scry-unobserved/document.json b/testdata/summary/scry-unobserved/document.json index 954a06a..c3a425f 100644 --- a/testdata/summary/scry-unobserved/document.json +++ b/testdata/summary/scry-unobserved/document.json @@ -12,24 +12,24 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "ok" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "tower", + "id": "spoke", "severity": "GREEN", "reasons": [ "expected_dark", diff --git a/testdata/summary/signal-present/document.json b/testdata/summary/signal-present/document.json index e9d48be..a0dac90 100644 --- a/testdata/summary/signal-present/document.json +++ b/testdata/summary/signal-present/document.json @@ -12,24 +12,24 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "ok" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "tower", + "id": "spoke", "severity": "GREEN", "reasons": [ "expected_dark", diff --git a/testdata/summary/simplex-green/document.json b/testdata/summary/simplex-green/document.json index e9d48be..a0dac90 100644 --- a/testdata/summary/simplex-green/document.json +++ b/testdata/summary/simplex-green/document.json @@ -12,24 +12,24 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "ok" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "tower", + "id": "spoke", "severity": "GREEN", "reasons": [ "expected_dark", diff --git a/testdata/summary/simplex-stale-green/document.json b/testdata/summary/simplex-stale-green/document.json index 594b688..c52e22d 100644 --- a/testdata/summary/simplex-stale-green/document.json +++ b/testdata/summary/simplex-stale-green/document.json @@ -14,24 +14,24 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "ok" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "GREEN", "reasons": [], "source": "simplex" }, { - "id": "tower", + "id": "spoke", "severity": "GREEN", "reasons": [ "expected_dark", diff --git a/testdata/summary/simplex-yellow-augur-red/document.json b/testdata/summary/simplex-yellow-augur-red/document.json index d18e7f2..d00f036 100644 --- a/testdata/summary/simplex-yellow-augur-red/document.json +++ b/testdata/summary/simplex-yellow-augur-red/document.json @@ -19,12 +19,12 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "unchecked" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "YELLOW", "reasons": [ "tcp_connect_ok", @@ -33,7 +33,7 @@ "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "GREEN", "reasons": [], "source": "simplex" diff --git a/testdata/summary/vantage-blind/document.json b/testdata/summary/vantage-blind/document.json index f526010..2a877be 100644 --- a/testdata/summary/vantage-blind/document.json +++ b/testdata/summary/vantage-blind/document.json @@ -12,12 +12,12 @@ } ], "vantage": { - "id": "lathe", + "id": "lab", "status": "blind" }, "hosts": [ { - "id": "box", + "id": "edge", "severity": "RED", "reasons": [ "vantage_blind" @@ -25,7 +25,7 @@ "source": "simplex" }, { - "id": "lathe", + "id": "lab", "severity": "RED", "reasons": [ "vantage_blind" diff --git a/testdata/targets/invalid/health-case.json b/testdata/targets/invalid/health-case.json index 64561e7..3f85fbf 100644 --- a/testdata/targets/invalid/health-case.json +++ b/testdata/targets/invalid/health-case.json @@ -1,11 +1,11 @@ { "apiVersion": "vigil.targets/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "generated_at": "2026-11-14T09:00:00Z", "targets": [ { - "host": "castle", + "host": "core", "job": "node", "health": "UP", "last_scrape": "2026-11-14T09:00:00Z" diff --git a/testdata/targets/invalid/host-case.json b/testdata/targets/invalid/host-case.json index 707cdfe..6c80a36 100644 --- a/testdata/targets/invalid/host-case.json +++ b/testdata/targets/invalid/host-case.json @@ -1,11 +1,11 @@ { "apiVersion": "vigil.targets/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "generated_at": "2026-11-14T09:00:00Z", "targets": [ { - "host": "Castle", + "host": "Core", "job": "node", "health": "up", "last_scrape": "2026-11-14T09:00:00Z" diff --git a/testdata/targets/invalid/job-address.json b/testdata/targets/invalid/job-address.json index d6b9d00..d72591c 100644 --- a/testdata/targets/invalid/job-address.json +++ b/testdata/targets/invalid/job-address.json @@ -1,11 +1,11 @@ { "apiVersion": "vigil.targets/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "generated_at": "2026-11-14T09:00:00Z", "targets": [ { - "host": "castle", + "host": "core", "job": "node.example.invalid:9100", "health": "up", "last_scrape": "2026-11-14T09:00:00Z" diff --git a/testdata/targets/valid/empty.json b/testdata/targets/valid/empty.json index dbda39f..27a8853 100644 --- a/testdata/targets/valid/empty.json +++ b/testdata/targets/valid/empty.json @@ -1,7 +1,7 @@ { "apiVersion": "vigil.targets/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "generated_at": "2026-11-14T09:00:00Z", "targets": [] } diff --git a/testdata/targets/valid/mixed.json b/testdata/targets/valid/mixed.json index ce2e04b..5eb4f9a 100644 --- a/testdata/targets/valid/mixed.json +++ b/testdata/targets/valid/mixed.json @@ -1,11 +1,11 @@ { "apiVersion": "vigil.targets/v0", "backend": "prom", - "vantage": "lathe", + "vantage": "lab", "generated_at": "2026-11-14T09:00:00Z", "targets": [ { - "host": "castle", + "host": "core", "job": "node", "health": "up", "last_scrape": "2026-11-14T09:00:00Z" From 5d57aeee7ea1687799cfaf86fce7b9e2160c9dc2 Mon Sep 17 00:00:00 2001 From: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com> Date: Sat, 14 Nov 2026 07:14:27 -0800 Subject: [PATCH 2/3] Use neutral host aliases in render tests, goldens and docs Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com> --- README.md | 7 ++++--- docs/cli.md | 2 +- example.config.yaml | 2 +- example.overlay.yaml | 8 ++++---- internal/render/render_test.go | 30 ++++++++++++++-------------- testdata/render/query-all-hosts.txt | 2 +- testdata/render/query-one-host.txt | 8 ++++---- testdata/render/sources-backends.txt | 2 +- testdata/render/targets-empty.txt | 2 +- testdata/render/targets-mixed.txt | 4 ++-- 10 files changed, 34 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index c7aa6cc..cf4c3a5 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Facet is the chrome), and it never computes severity from raw data. ``` Simplex ──verdict document (file)──────▶ ──vigil.summary/v0 (pull, read token)──▶ Facet Augur ──verdict document (file)──────▶ Vigil ◀──vigil.signal/v0 (POST, write token)───── -prom (lathe) · grafana (lathe) ──named──▶ Cubit / Scry ──▶ informational blocks +prom (lab) · grafana (lab) ──named──▶ Cubit / Scry ──▶ informational blocks ``` ## Reading a summary (V2) @@ -133,7 +133,8 @@ in the config is exit 5 for every command. as `redacted`. A scrape URL, a last error or discovered labels never reach the output. - `prom query` runs exactly one named query from the config. The host slug is - the only template variable and `--host` must be a mapped or public slug. + the only template variable and `--host` must be a slug the overlay's + `hosts[]` defines. The request asks for one series more than the cap, so more results fail with `series_cap` instead of a truncated answer; any backend warning fails with `query_warnings` instead of a partial answer. Every result carries the @@ -166,7 +167,7 @@ in the config is exit 5 for every command. environment reference, and an optional `vantage` label on the prom backend. Backend addresses live in an overlay (`example.overlay.yaml` is the tracked example; a real overlay is never committed); the overlay's `hosts[]` maps the -instance labels a backend reports onto public slugs. Both examples validate +instance labels a backend reports onto the slugs it prints. Both examples validate against the JSON Schemas under `schema/`. `overall` is the worst severity among the readable verdicts in `verdicts[]`, diff --git a/docs/cli.md b/docs/cli.md index d0dc84e..d9da7ed 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -95,7 +95,7 @@ there is no free-form path over HTTP or on the CLI, and the host slug | Flag | Meaning | | --- | --- | -| `--host SLUG` | fills `{{.host}}`; must be a mapped or public slug | +| `--host SLUG` | fills `{{.host}}`; must be a slug the overlay's `hosts[]` defines | Placeholder rules, both exit 3 with no backend call: diff --git a/example.config.yaml b/example.config.yaml index 57ae022..5e35155 100644 --- a/example.config.yaml +++ b/example.config.yaml @@ -19,7 +19,7 @@ listen: "127.0.0.1:10082" backends: - id: prom kind: prom - vantage: lathe + vantage: lab - id: grafana kind: grafana diff --git a/example.overlay.yaml b/example.overlay.yaml index 76060ca..6d4260a 100644 --- a/example.overlay.yaml +++ b/example.overlay.yaml @@ -17,11 +17,11 @@ backends: # unmapped. An instance is a bare host or a host with a port, exactly as the # backend reports it; brackets hold an IPv6 literal. hosts: - - slug: castle + - slug: core instances: - "198.51.100.10:9100" - - castle.example.invalid - - slug: lathe + - core.example.invalid + - slug: lab instances: - "198.51.100.20:9100" - - lathe.example.invalid + - lab.example.invalid diff --git a/internal/render/render_test.go b/internal/render/render_test.go index 86285d7..0ee94e8 100644 --- a/internal/render/render_test.go +++ b/internal/render/render_test.go @@ -262,17 +262,17 @@ func TestJSONBytes(t *testing.T) { } switch { case kc.kind == "targets" && kc.name == "mixed": - want := `{"apiVersion":"vigil.targets/v0","backend":"prom","vantage":"lathe","generated_at":"2026-11-14T09:00:00Z","targets":[{"host":"castle","job":"node","health":"up","last_scrape":"2026-11-14T09:00:00Z"},{"host":"unmapped","job":"redacted","health":"unknown","last_scrape":null}]}` + "\n" + want := `{"apiVersion":"vigil.targets/v0","backend":"prom","vantage":"lab","generated_at":"2026-11-14T09:00:00Z","targets":[{"host":"core","job":"node","health":"up","last_scrape":"2026-11-14T09:00:00Z"},{"host":"unmapped","job":"redacted","health":"unknown","last_scrape":null}]}` + "\n" if got := string(jsonBytes(t, kc)); got != want { t.Errorf("targets json = %s, want %s", got, want) } case kc.kind == "query" && kc.name == "one-host": - want := `{"apiVersion":"vigil.query/v0","backend":"prom","vantage":"lathe","name":"up_by_host","host":"castle","evaluated_at":"2026-11-14T09:00:00Z","series":[{"host":"castle","job":"node","value":"1"}]}` + "\n" + want := `{"apiVersion":"vigil.query/v0","backend":"prom","vantage":"lab","name":"up_by_host","host":"core","evaluated_at":"2026-11-14T09:00:00Z","series":[{"host":"core","job":"node","value":"1"}]}` + "\n" if got := string(jsonBytes(t, kc)); got != want { t.Errorf("query json = %s, want %s", got, want) } case kc.kind == "query" && kc.name == "all-hosts": - want := `{"apiVersion":"vigil.query/v0","backend":"prom","vantage":"lathe","name":"up_by_host","evaluated_at":"2026-11-14T09:00:00Z","series":[]}` + "\n" + want := `{"apiVersion":"vigil.query/v0","backend":"prom","vantage":"lab","name":"up_by_host","evaluated_at":"2026-11-14T09:00:00Z","series":[]}` + "\n" if got := string(jsonBytes(t, kc)); got != want { t.Errorf("query json = %s, want %s", got, want) } @@ -282,7 +282,7 @@ func TestJSONBytes(t *testing.T) { t.Errorf("health json = %s, want %s", got, want) } case kc.kind == "sources" && kc.name == "backends": - want := `{"apiVersion":"vigil.sources/v0","generated_at":"2026-11-14T09:00:00Z","sources":[{"id":"prom","kind":"prom","state":"ok","observed_at":"2026-11-14T09:00:00Z","last_ok":"2026-11-14T09:00:00Z","vantage":"lathe"},{"id":"grafana","kind":"grafana","state":"unavailable","observed_at":null,"last_ok":null,"detail_code":"not_health"}]}` + "\n" + want := `{"apiVersion":"vigil.sources/v0","generated_at":"2026-11-14T09:00:00Z","sources":[{"id":"prom","kind":"prom","state":"ok","observed_at":"2026-11-14T09:00:00Z","last_ok":"2026-11-14T09:00:00Z","vantage":"lab"},{"id":"grafana","kind":"grafana","state":"unavailable","observed_at":null,"last_ok":null,"detail_code":"not_health"}]}` + "\n" if got := string(jsonBytes(t, kc)); got != want { t.Errorf("sources json = %s, want %s", got, want) } @@ -402,8 +402,8 @@ func TestTablesPrintOnlyWhatTheDocumentHas(t *testing.T) { if err := render.Query(&qbuf1, &qd1); err != nil { t.Fatalf("render query: %v", err) } - if got := lineFields(t, qbuf1.String(), "HOST"); !equalFields(got, []string{"HOST", "castle"}) { - t.Errorf("one-host HOST line = %v, want HOST castle", got) + if got := lineFields(t, qbuf1.String(), "HOST"); !equalFields(got, []string{"HOST", "core"}) { + t.Errorf("one-host HOST line = %v, want HOST core", got) } if got := headerFields(t, qbuf1.String()); !equalFields(got, []string{"HOST", "JOB", "VALUE"}) { t.Errorf("one-host header = %v, want HOST JOB VALUE", got) @@ -423,12 +423,12 @@ func TestTablesPrintOnlyWhatTheDocumentHas(t *testing.T) { // not as a tracked golden: the scrub's hostname rule reads a dotted cell // as a name, and the value strip only covers the JSON value shape. for key, want := range map[string][]string{ - "castle": {"castle", "1"}, - "tower": {"tower", "-0.5"}, - "lathe": {"lathe", "1.5e-3"}, - "box": {"box", "NaN"}, - "apiary": {"apiary", "+Inf"}, - "citadel": {"citadel", "-Inf"}, + "core": {"core", "1"}, + "spoke": {"spoke", "-0.5"}, + "lab": {"lab", "1.5e-3"}, + "edge": {"edge", "NaN"}, + "annex": {"annex", "+Inf"}, + "depot": {"depot", "-Inf"}, } { if got := lineFields(t, qbuf2.String(), key); !equalFields(got, want) { t.Errorf("special-values row %s = %v, want %v", key, got, want) @@ -518,13 +518,13 @@ func TestNullabilityRoundTrip(t *testing.T) { t.Errorf("row with absent detail code and vantage = %s, want %s", got, wantAbsent) } row.DetailCode = new("not_health") - row.Vantage = "lathe" - wantPresent := `{"id":"prom","kind":"prom","state":"ok","observed_at":"2026-11-14T09:00:00Z","last_ok":null,"detail_code":"not_health","vantage":"lathe"}` + row.Vantage = "lab" + wantPresent := `{"id":"prom","kind":"prom","state":"ok","observed_at":"2026-11-14T09:00:00Z","last_ok":null,"detail_code":"not_health","vantage":"lab"}` if got := roundTrip(row); got != wantPresent { t.Errorf("row with present detail code and vantage = %s, want %s", got, wantPresent) } row.ObservedAt = nil - wantNull := `{"id":"prom","kind":"prom","state":"ok","observed_at":null,"last_ok":null,"detail_code":"not_health","vantage":"lathe"}` + wantNull := `{"id":"prom","kind":"prom","state":"ok","observed_at":null,"last_ok":null,"detail_code":"not_health","vantage":"lab"}` if got := roundTrip(row); got != wantNull { t.Errorf("row with null observed at = %s, want %s", got, wantNull) } diff --git a/testdata/render/query-all-hosts.txt b/testdata/render/query-all-hosts.txt index a8cee8f..c2963b6 100644 --- a/testdata/render/query-all-hosts.txt +++ b/testdata/render/query-all-hosts.txt @@ -1,5 +1,5 @@ BACKEND prom -VANTAGE lathe +VANTAGE lab NAME up_by_host EVALUATED_AT 2026-11-14T09:00:00Z diff --git a/testdata/render/query-one-host.txt b/testdata/render/query-one-host.txt index 29d8757..0b774a0 100644 --- a/testdata/render/query-one-host.txt +++ b/testdata/render/query-one-host.txt @@ -1,8 +1,8 @@ BACKEND prom -VANTAGE lathe +VANTAGE lab NAME up_by_host -HOST castle +HOST core EVALUATED_AT 2026-11-14T09:00:00Z -HOST JOB VALUE -castle node 1 +HOST JOB VALUE +core node 1 diff --git a/testdata/render/sources-backends.txt b/testdata/render/sources-backends.txt index cb7616f..18a2a9a 100644 --- a/testdata/render/sources-backends.txt +++ b/testdata/render/sources-backends.txt @@ -1,5 +1,5 @@ GENERATED_AT 2026-11-14T09:00:00Z ID KIND STATE OBSERVED_AT LAST_OK DETAIL_CODE VANTAGE -prom prom ok 2026-11-14T09:00:00Z 2026-11-14T09:00:00Z - lathe +prom prom ok 2026-11-14T09:00:00Z 2026-11-14T09:00:00Z - lab grafana grafana unavailable - - not_health - diff --git a/testdata/render/targets-empty.txt b/testdata/render/targets-empty.txt index 1c83252..cfc4baf 100644 --- a/testdata/render/targets-empty.txt +++ b/testdata/render/targets-empty.txt @@ -1,5 +1,5 @@ BACKEND prom -VANTAGE lathe +VANTAGE lab GENERATED_AT 2026-11-14T09:00:00Z TARGET JOB HEALTH LAST_SCRAPE diff --git a/testdata/render/targets-mixed.txt b/testdata/render/targets-mixed.txt index f80e95c..b6626bb 100644 --- a/testdata/render/targets-mixed.txt +++ b/testdata/render/targets-mixed.txt @@ -1,7 +1,7 @@ BACKEND prom -VANTAGE lathe +VANTAGE lab GENERATED_AT 2026-11-14T09:00:00Z TARGET JOB HEALTH LAST_SCRAPE -castle node up 2026-11-14T09:00:00Z +core node up 2026-11-14T09:00:00Z unmapped redacted unknown - From bee826fc940128a525635755992ce954f55ac598 Mon Sep 17 00:00:00 2001 From: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com> Date: Sat, 14 Nov 2026 07:18:24 -0800 Subject: [PATCH 3/3] Use neutral host aliases in CLI tests, scrub and docs The CLI tests, the scrub allowlist and its self-test inputs, the contributing rule and the semantics page use neutral host aliases and example.invalid. The test overlay lists the alias it passes to --host, because a host slug now comes only from the overlay. Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com> --- CONTRIBUTING.md | 2 +- cmd/vigil/fuzz_cli_test.go | 6 +++--- cmd/vigil/wire_grafana_test.go | 4 ++-- cmd/vigil/wire_test.go | 17 +++++++++-------- docs/semantics.md | 6 +++--- scripts/scrub.sh | 32 ++++++++++++++++---------------- 6 files changed, 34 insertions(+), 33 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 976a0b8..cb1bdcd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,7 +76,7 @@ Use golangci-lint v2 and a current govulncheck. All checks are blocking. - **No `os/exec`** in non-test code, and no schema validator in the binary. The linter enforces both. - **One HTTP client.** Every call to a backend goes through `internal/httpx`: GET only, no redirect, no proxy, a body cap, a deadline, two calls in flight per backend. The linter rejects `net/http` anywhere else in non-test code. - **Severity comes from authorities.** Vigil combines verdicts and applies the stale and missing-authority caps. It does not compute severity from raw data. -- **Slugs only.** Use the public host slugs (`castle`, `tower`, `citadel`, `apiary`, `lathe`, `box`) in code, docs, fixtures and examples. No IP addresses, hostnames or secrets. Placeholders use reserved documentation values. Real addresses live in an untracked overlay. +- **Aliases only.** Fixtures, docs and examples use neutral host aliases (`core`, `spoke`, `depot`, `annex`, `lab`, `edge`) and `example.invalid`, never real machine names. No IP addresses, hostnames or secrets. Placeholders use reserved documentation values. An operator's real slugs and addresses live only in their untracked, off-repo overlay. - **Schemas are the contract.** JSON Schemas under `schema/` are written by hand. A change that adds a field is additive within `v0`; anything that removes or renames one needs a new major. - **Hermetic tests.** Table-driven, `httptest` for every backend, no live network, no wall clock (inject the clock). diff --git a/cmd/vigil/fuzz_cli_test.go b/cmd/vigil/fuzz_cli_test.go index 8b41801..e752a51 100644 --- a/cmd/vigil/fuzz_cli_test.go +++ b/cmd/vigil/fuzz_cli_test.go @@ -40,16 +40,16 @@ var usageMessages = map[string]bool{ // overridden never reaches anything. func FuzzCLIArgs(f *testing.F) { for _, s := range []string{ - "version", "prom targets", "prom query up_all", "prom query up_by_host --host castle", + "version", "prom targets", "prom query up_all", "prom query up_by_host --host core", "sources --json", "grafana health --now 2026-11-14T09:00:00Z", "--help", "prom --help", "sources http://leak.example.invalid/x", "prom query up{job=\"x\"}", "--config https://leak.example.invalid sources", "--overlay //leak/x sources", "prom query rate(x[5m]) --host 192.0.2.7:9090", "--now yesterday sources", "--nope", "-x", "", "prom", "grafana", "help", "completion bash", "sources --config", "--json=maybe sources", - "prom query a b", "version extra", "sources --host castle", "--now 2026-11-14T09:00:00Z --json prom targets", + "prom query a b", "version extra", "sources --host core", "--now 2026-11-14T09:00:00Z --json prom targets", "prom query http://leak.example.invalid/x", "prom query up_all --host http://leak.example.invalid", "prom query up(x)", "prom query up_all --host a{b}", "prom query a --host \" --host ", "-hh \"", "\"000000 -h", "--overlay \" sources", - "prom query up_all --config ? --overlay #", "prom query up_all --host Castle", "prom query UP", + "prom query up_all --config ? --overlay #", "prom query up_all --host Core", "prom query UP", } { f.Add(s) } diff --git a/cmd/vigil/wire_grafana_test.go b/cmd/vigil/wire_grafana_test.go index c9ee93d..0b90485 100644 --- a/cmd/vigil/wire_grafana_test.go +++ b/cmd/vigil/wire_grafana_test.go @@ -19,7 +19,7 @@ listen: 127.0.0.1:10082 backends: - id: prom kind: prom - vantage: lathe + vantage: lab - id: grafana kind: grafana authorities: @@ -263,7 +263,7 @@ func TestSourcesRowsAreData(t *testing.T) { if r.LastOK != nil { t.Errorf("%s: last_ok = %v, V1 keeps no state", tc.name, *r.LastOK) } - if r.Kind == "prom" && r.Vantage != "lathe" { + if r.Kind == "prom" && r.Vantage != "lab" { t.Errorf("%s: prom row vantage = %q", tc.name, r.Vantage) } } diff --git a/cmd/vigil/wire_test.go b/cmd/vigil/wire_test.go index 23a7da3..53f9e30 100644 --- a/cmd/vigil/wire_test.go +++ b/cmd/vigil/wire_test.go @@ -97,7 +97,7 @@ listen: 127.0.0.1:10082 backends: - id: prom kind: prom - vantage: lathe + vantage: lab authorities: - id: simplex path_ref: /var/lib/vigil/simplex.json @@ -117,7 +117,8 @@ queries: var backendSeq atomic.Int32 // writeDocs writes a config and an overlay that points at address, under a -// backend id no other test uses. +// backend id no other test uses. The overlay lists the host alias core in +// hosts[], because a --host slug is accepted only from the overlay. func writeDocs(t *testing.T, cfgBody, address string) (cfg, ov string) { t.Helper() id := fmt.Sprintf("prom%d", backendSeq.Add(1)) @@ -128,7 +129,7 @@ func writeDocs(t *testing.T, cfgBody, address string) (cfg, ov string) { if err := os.WriteFile(cfg, []byte(cfgBody), 0o600); err != nil { t.Fatal(err) } - overlay := fmt.Sprintf("apiVersion: vigil.overlay/v0\nbackends:\n - id: %s\n address: %s\n", id, address) + overlay := fmt.Sprintf("apiVersion: vigil.overlay/v0\nbackends:\n - id: %s\n address: %s\nhosts:\n - slug: core\n instances:\n - core.example.invalid:9100\n", id, address) if err := os.WriteFile(ov, []byte(overlay), 0o600); err != nil { t.Fatal(err) } @@ -164,7 +165,7 @@ func TestPromTargetsJSON(t *testing.T) { t.Errorf("stdout leaks %q:\n%s", leak, out) } } - if !strings.Contains(out, `"vantage":"lathe"`) || !strings.Contains(out, `"backend":"prom`) { + if !strings.Contains(out, `"vantage":"lab"`) || !strings.Contains(out, `"backend":"prom`) { t.Errorf("document lacks backend or vantage: %s", out) } // The same inputs print the same bytes. @@ -183,7 +184,7 @@ func TestPromTargetsTable(t *testing.T) { } // The table is internal/render's, called as it is: header block, a blank // line, then the rows. - for _, want := range []string{"BACKEND", "VANTAGE", "lathe", "GENERATED_AT 2026-11-14T09:00:00Z", "TARGET", "JOB", "HEALTH", "LAST_SCRAPE"} { + for _, want := range []string{"BACKEND", "VANTAGE", "lab", "GENERATED_AT 2026-11-14T09:00:00Z", "TARGET", "JOB", "HEALTH", "LAST_SCRAPE"} { if !strings.Contains(out, want) { t.Errorf("table lacks %q:\n%s", want, out) } @@ -200,7 +201,7 @@ func TestPromQueryJSON(t *testing.T) { cfg, ov := writeDocs(t, wireConfig, srv.URL) for _, args := range [][]string{ {"prom", "query", "up_all"}, - {"prom", "query", "up_by_host", "--host", "castle"}, + {"prom", "query", "up_by_host", "--host", "core"}, } { full := append(append([]string{}, args...), "--json", "--config", cfg, "--overlay", ov, "--now", "2026-11-14T09:00:00Z") code, out, errs := live(t, full...) @@ -235,7 +236,7 @@ func TestPromQueryHostRules(t *testing.T) { code string }{ {[]string{"prom", "query", "up_by_host"}, "missing_host"}, - {[]string{"prom", "query", "up_all", "--host", "castle"}, "unexpected_host"}, + {[]string{"prom", "query", "up_all", "--host", "core"}, "unexpected_host"}, {[]string{"prom", "query", "up_by_host", "--host", "nosuchhost"}, "unknown_host"}, {[]string{"prom", "query", "no_such_query"}, "unknown_query"}, } { @@ -316,7 +317,7 @@ func TestConfigErrorsDoNotEchoValues(t *testing.T) { "locator-url": strings.Replace(wireConfig, "path_ref: /var/lib/vigil/simplex.json", "path_ref: https://"+marker+".example.invalid/x", 1), "unknown-key": wireConfig + marker + ": 1\n", "query-name-url": strings.Replace(wireConfig, "name: up_all", "name: http://"+marker+".example.invalid/x", 1), - "dup-backend": strings.Replace(wireConfig, "backends:\n - id: prom\n kind: prom\n vantage: lathe\n", "backends:\n - id: prom\n kind: prom\n - id: prom\n kind: prom\n", 1), + "dup-backend": strings.Replace(wireConfig, "backends:\n - id: prom\n kind: prom\n vantage: lab\n", "backends:\n - id: prom\n kind: prom\n - id: prom\n kind: prom\n", 1), } { cfg, ov := writeDocs(t, body, srv.URL) code, out, errs := live(t, "prom", "targets", "--config", cfg, "--overlay", ov) diff --git a/docs/semantics.md b/docs/semantics.md index 34f7322..6758730 100644 --- a/docs/semantics.md +++ b/docs/semantics.md @@ -84,7 +84,7 @@ There is no `/v0/query`, no `/v0/queries`, and no route that takes a URL, a sele - **The name is the only handle.** It must match the shape of a configured name (`^[a-z][a-z0-9_]{0,47}$`). A URL, a selector or an expression in its place is a usage error, exit 3, before any file is read. Test: `TestURLShapedArgumentsExitUsage`. - **One placeholder, one literal.** The host slug is the only template variable, and the only substitution is the exact text `{{.host}}`. Vigil replaces that text and runs no template engine. Config validation refuses any other `{{` in an `expr`. Fixture: `testdata/config/invalid/expr-second-variable.yaml`. -- **`--host` is checked before it reaches an expression.** It must be a slug (`^[a-z][a-z0-9-]{0,31}$`) that is listed in the overlay's `hosts[]` or is one of the public slugs. Anything else is exit 3. An unchecked value would let a caller write PromQL through a label matcher. +- **`--host` is checked before it reaches an expression.** It must be a slug (`^[a-z][a-z0-9-]{0,31}$`) that is listed in the overlay's `hosts[]`. No slug is built in, so a slug the overlay does not list is exit 3, the same as any other unknown value. An unchecked value would let a caller write PromQL through a label matcher. - **The expression and the flag must agree.** An `expr` that names `{{.host}}`, run without `--host`, is exit 3 with the code `missing_host`. `--host` given to an `expr` with no placeholder is exit 3 with the code `unexpected_host`. There is no fan-out in V1: one run asks about one host or about the whole expression, never about every host in turn. - **Instant queries only.** The request carries `query`, `time` (the pinned clock when `--now` is set), `timeout` and `limit`. - **Deadline.** 5s by default and 10s at most, set per query in config as `5s` to `10s`. It is sent as the API `timeout` parameter and enforced by a client deadline. A longer value is refused at load. Fixture: `testdata/config/invalid/timeout-too-long.yaml`. @@ -115,7 +115,7 @@ A `vigil.signal/v0` is ephemeral and arrives only by authenticated POST. - The Simplex writer publishes its document on every exit that carries a verdict or a blind vantage: 0, 1, 2 and 5. It never writes on 3 (configuration error) or 4 (I/O error); with no file there is nothing to read, so Vigil reports that authority `unavailable`. The vendored Simplex fixtures show it: `testdata/simplex/config-error` (exit 3) and `testdata/simplex/io-error` (exit 4) hold an `exit` file and no document; every other case holds both. - The writer of record is `simplex serve --out PATH`, which rewrites the file every interval (default 30s, well inside Vigil's 120s `stale_after`). The fallback is a timer that runs `simplex check --json --out PATH`. - Prometheus and Grafana are queried live and have no freshness bound; their state is `ok` or unreachable. -- Vigil queries the secondary Prometheus on lathe only. The primary's liveness reaches it through a named query on the peer series. +- Vigil queries the secondary Prometheus on the vantage host only. The primary's liveness reaches it through a named query on the peer series. ## 10. Versioning @@ -229,7 +229,7 @@ Tests, by column: exit 0 is `TestPromTargetsJSON`, `TestPromQueryJSON`, `TestGra `vigil.overlay/v0` is the only place an address exists. It is YAML, strict, and never committed (the scrub fails the tree if one is tracked). It has two keys beyond `apiVersion`: - `backends[]`: `id` and `address`, keyed by the backend ids declared in config. An address is a scheme, a host, an optional port and optional path segments. Userinfo, a query, a fragment and any `.` or `..` segment are refused. Fixtures: `testdata/overlay/invalid/address-credentials.yaml`, `address-query.yaml` and `address-dot-segment.yaml`. -- `hosts[]` (optional): each `{slug, instances[]}` maps the `instance` labels a backend reports onto one public slug. An instance is a host or `host:port` as Prometheus reports it, and it is matched exactly. A host with no instances, or an instance that is a path, is refused. Fixtures: `testdata/overlay/valid/hosts.yaml`, `testdata/overlay/invalid/host-empty-instances.yaml` and `host-instance-path.yaml`. +- `hosts[]` (optional): each `{slug, instances[]}` maps the `instance` labels a backend reports onto one slug. An instance is a host or `host:port` as Prometheus reports it, and it is matched exactly. A host with no instances, or an instance that is a path, is refused. Fixtures: `testdata/overlay/valid/hosts.yaml`, `testdata/overlay/invalid/host-empty-instances.yaml` and `host-instance-path.yaml`. Config adds one optional key to a backend, `vantage`: the slug of the place the backend is queried from. It is carried in every `prom` result and in the backend's `sources[]` row, so a reader can tell which side of the mesh answered. Fixtures: `testdata/config/valid/vantage.yaml`, `testdata/config/invalid/backend-vantage-not-a-slug.yaml`. diff --git a/scripts/scrub.sh b/scripts/scrub.sh index a115632..c36aae5 100755 --- a/scripts/scrub.sh +++ b/scripts/scrub.sh @@ -22,7 +22,7 @@ # # Coverage limits: the machine-name rule checks the values of "host", # "instance" and "id" keys (any case, bare, single- or double-quoted) against -# the public slugs, the product ids, 32-digit hex ids and a short list of +# the host aliases, the product ids, 32-digit hex ids and a short list of # placeholders; an empty, list or block value is a finding. The hostname # rule treats any dotted name in a fixture as a hostname, after blanking # the exact schema URL values, "$id" values under the two Hedronite repos, @@ -68,7 +68,7 @@ fi SELF_DIR=$(cd "$(dirname "$0")" && pwd) || exit 2 SELF=$SELF_DIR/$(basename "$0") -SLUGS="castle tower citadel apiary lathe box unmapped" +SLUGS="core spoke depot annex lab edge unmapped" # Ids that are not machines: the authorities, sources and backends. IDS_OK="simplex augur cubit scry grafana prom" # Placeholder values, exact and case-sensitive. @@ -253,7 +253,7 @@ scan_file() { if [ "$fixture" = 1 ]; then scan_host_keys "$f" "$shown"; fi } -# A host, instance or id value is a public slug (any case), a product id, a +# A host, instance or id value is a host alias (any case), a product id, a # 32-digit hex id, or one of the exact placeholders. host_value_ok() { local v=$1 w ok=1 re='^[0-9a-f]{32}$' @@ -291,7 +291,7 @@ scan_host_keys() { # path displaypath if [ -z "$v" ]; then report "$2" "$ln" host-slug "host or id key has an empty, list or block value" elif ! host_value_ok "$v"; then - report "$2" "$ln" host-slug "host or id value is not a public slug or known id" + report "$2" "$ln" host-slug "host or id value is not a host alias or known id" fi done } @@ -494,7 +494,7 @@ selftest() { cg="100.64.$((6 + 6)).34" ten="1$((0 * 7))" ten="$ten.1.2.3" - tsn="box.TS.N""ET" + tsn="edge.TS.N""ET" # 1. The planted files must fail, and every file rule must fire on them. if [ ! -d testdata/scrub ]; then @@ -554,17 +554,17 @@ example.invalid host.example.invalid "$schema": "https://json-schema.org/draft/2020-12/schema" "$id": "https://github.com/Hedronite/vigil/schema/vigil.summary.v0.schema.json" "$id": "https://github.com/Hedronite/simplex/schema/simplex.probe.v0.schema.json" -host: castle -Host: Castle -HOST: 'tower' -"host": "box" -'host': 'box' -"instance": "lathe" +host: core +Host: Core +HOST: 'spoke' +"host": "edge" +'host': 'edge' +"instance": "lab" "id": "simplex" "id": "00000000000000000000000000000000" "id": "XYZ" -- id: apiary -{"Id": "citadel", "host": "box"} +- id: annex +{"Id": "depot", "host": "edge"} "kind": "deploy.start", "source": "ci.build" "generated_at": "2026-11-13T18:00:00.123456Z" tool 1.27.3, schema v0.1.0, file config.yaml and document.json @@ -579,7 +579,7 @@ apiVersion: 'vigil.overlay/v0' {"value": "1.5e-3"} {"value": "-0.5"} {"value": "+1E10"} {"value": "42"} {"value": "Inf"} {"value": "+Inf"} {"value": "-Inf"} {"value": "NaN"} listen: localhost:10082 -{"hostname": "x", "ghost": "y", "localhost": "z", "hosts": ["castle"]} +{"hostname": "x", "ghost": "y", "localhost": "z", "hosts": ["core"]} {"s": "caf\u00e9 \u0001 \u007f \u0000 \n \t"} s: "\x00 \x01 \x1f \x7f \x80 \xff \U00000001 \U0000007f \U0001F600 \U000000e9 \u00e9" EOF @@ -598,7 +598,7 @@ EOF mkdir "$tmp/big" i=0 while [ "$i" -lt 600 ]; do - printf 'host: castle\n{"id": "box"}\n' >"$tmp/big/f$i.json" + printf 'host: core\n{"id": "edge"}\n' >"$tmp/big/f$i.json" i=$((i + 1)) done scan_dir "$tmp/big" >"$tmp/big.out" 2>"$tmp/big.err" @@ -730,7 +730,7 @@ EOF {"domain": ".prom.corp.com"} {"domain": ".prom.lab.de"} {"ho\u0073t": "somemachine"} -{"\u0068ost": "castle"} +{"\u0068ost": "core"} {"a": "\u0031"} url: "prom\x2ecorp\x2ede" "\x68ost": somemachine