bus5 B4 (A-64): snapshots-filling has scope module and id nats.snapshots
Builds: design 47 G §681, A-64
This commit is contained in:
@@ -737,7 +737,7 @@ func TestTheKeeperMakesWhatAVerdictAsksForAndSaysIt(t *testing.T) {
|
||||
t.Fatalf("the drop's record: %+v", got)
|
||||
}
|
||||
findings := k.Finding.(*findingLog)
|
||||
if fmt.Sprint(findings.calls) != "[write nats.snapshots.snapshots-filling nats]" {
|
||||
if fmt.Sprint(findings.calls) != "[write module.nats.snapshots.snapshots-filling nats]" {
|
||||
t.Errorf("100 of 120 bytes is 83%%, so the finding is written through the held writer: %v", findings.calls)
|
||||
}
|
||||
// Another snapshot of 100 bytes would pass the cap: refused, its file removed, nothing deleted from the bus.
|
||||
@@ -754,7 +754,7 @@ func TestTheKeeperMakesWhatAVerdictAsksForAndSaysIt(t *testing.T) {
|
||||
findings.calls = nil
|
||||
k.ExpireSnapshots()
|
||||
if _, _, found, _ := store.Get(StateRequests, "r10"); found || fmt.Sprint(files.removed) != "[/snapshots/m_log.tar /snapshots/KV_m_drafts.tar]" ||
|
||||
len(journal) != 1 || !strings.Contains(journal[0], "past its 90 days") || fmt.Sprint(findings.calls) != "[clear nats.snapshots.snapshots-filling]" {
|
||||
len(journal) != 1 || !strings.Contains(journal[0], "past its 90 days") || fmt.Sprint(findings.calls) != "[clear module.nats.snapshots.snapshots-filling]" {
|
||||
t.Errorf("after 91 days: removed %v, journal %v, finding calls %v", files.removed, journal, findings.calls)
|
||||
}
|
||||
if _, _, found, _ := store.Get(StateRequests, "r0"); !found {
|
||||
|
||||
@@ -29,7 +29,7 @@ const (
|
||||
// FindingSnapshotsFilling is the finding's kind; its scope is the bus module and its id SnapshotsID.
|
||||
FindingSnapshotsFilling = "snapshots-filling"
|
||||
// SnapshotsID is the id of the finding `snapshots-filling`.
|
||||
SnapshotsID = "snapshots"
|
||||
SnapshotsID = "nats.snapshots"
|
||||
)
|
||||
|
||||
// Findings is the bus module's finding writer, a held writer of mesh-sdk (views.HeldWriter): the keeper writes and clears
|
||||
@@ -275,7 +275,7 @@ func (k *Keeper) snapshotsFill(used int64) {
|
||||
ctx := context.Background()
|
||||
switch {
|
||||
case now:
|
||||
f := meshconditions.Finding{Scope: Module, ID: SnapshotsID, Kind: FindingSnapshotsFilling,
|
||||
f := meshconditions.Finding{Scope: "module", ID: SnapshotsID, Kind: FindingSnapshotsFilling,
|
||||
Subject: meshconditions.Subject{Scope: "module", ID: Module},
|
||||
Severity: meshconditions.FindingSeverityWarning, Headline: "The bus module's snapshots are filling up",
|
||||
Summary: fmt.Sprintf("the snapshots hold %d of %d bytes (%d%%)", used, capBytes, pct),
|
||||
@@ -287,7 +287,7 @@ func (k *Keeper) snapshotsFill(used int64) {
|
||||
k.logf("the finding %s cannot be written: %v", FindingSnapshotsFilling, err)
|
||||
}
|
||||
case was || unjudged:
|
||||
if err := k.Finding.Clear(ctx, Module, SnapshotsID, FindingSnapshotsFilling, "the snapshots are under 80 % of their cap"); err != nil {
|
||||
if err := k.Finding.Clear(ctx, "module", SnapshotsID, FindingSnapshotsFilling, "the snapshots are under 80 % of their cap"); err != nil {
|
||||
k.logf("the finding %s cannot be cleared: %v", FindingSnapshotsFilling, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user