boot outcomes metric: fix labels and add some checks for the new metric
authorWard Vandewege <ward@curii.com>
Mon, 3 Aug 2020 20:04:31 +0000 (16:04 -0400)
committerWard Vandewege <ward@curii.com>
Mon, 3 Aug 2020 20:05:44 +0000 (16:05 -0400)
in the tests.

refs #16636

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

lib/dispatchcloud/dispatcher_test.go
lib/dispatchcloud/worker/pool.go

index dd9d811818fae48704ace6f9bd0d808750e8b6f6..aa5f22a501331a2bdd108878987e25b133df720b 100644 (file)
@@ -207,6 +207,10 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) {
        c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="0",operation="Destroy"} [^0].*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="1",operation="Create"} [^0].*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*driver_operations{error="1",operation="List"} 0\n.*`)
+       c.Check(resp.Body.String(), check.Matches, `(?ms).*boot_outcomes{outcome="aborted"} 0.*`)
+       c.Check(resp.Body.String(), check.Matches, `(?ms).*boot_outcomes{outcome="disappeared"} [^0].*`)
+       c.Check(resp.Body.String(), check.Matches, `(?ms).*boot_outcomes{outcome="failure"} [^0].*`)
+       c.Check(resp.Body.String(), check.Matches, `(?ms).*boot_outcomes{outcome="success"} [^0].*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*instances_disappeared{state="shutdown"} [^0].*`)
        c.Check(resp.Body.String(), check.Matches, `(?ms).*instances_disappeared{state="unknown"} 0\n.*`)
 }
index efcc102e825bc9157ffe37ccb7e220c88c246e5f..12bc1cdd71636263cebc0c8f21bd283d791aec04 100644 (file)
@@ -600,7 +600,7 @@ func (wp *Pool) registerMetrics(reg *prometheus.Registry) {
                Subsystem: "dispatchcloud",
                Name:      "boot_outcomes",
                Help:      "Boot outcomes by type.",
-       }, []string{"state"})
+       }, []string{"outcome"})
        for k := range validBootOutcomes {
                wp.mBootOutcomes.WithLabelValues(string(k)).Add(0)
        }
@@ -610,7 +610,7 @@ func (wp *Pool) registerMetrics(reg *prometheus.Registry) {
                Subsystem: "dispatchcloud",
                Name:      "instances_disappeared",
                Help:      "Number of occurrences of an instance disappearing from the cloud provider's list of instances.",
-       }, []string{"outcome"})
+       }, []string{"state"})
        for _, v := range stateString {
                wp.mDisappearances.WithLabelValues(v).Add(0)
        }