Skip to content

Commit

Permalink
SLM uneahlthy policies diagnosis recommends correct URL in action (#9…
Browse files Browse the repository at this point in the history
…1506) (#91584)

THe SLM indicator advises to check the uneahlthy SLM policy to get more
details about the health condition.
The current message is something along the lines of
```
Check the snapshot lifecycle policy for detailed failure info:
- /_slm/policy/<cloud-snapshot-{now/d}>?human
```
This message uses the policy name (ie. `<cloud-snapshot-{now/d}>`) as
opposed to the policy id (ie. `/_slm/policy/cloud-snapshot-policy?human`).

This changes the diagnosis to advise the correct URL using the policy
id.
  • Loading branch information
andreidan committed Nov 15, 2022
1 parent 610f39b commit c240141
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/91506.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 91506
summary: SLM uneahlthy policies diagnosis recommends correct URL in action
area: Health
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public HealthIndicatorResult calculate(boolean explain, HealthInfo healthInfo) {
: "An automated snapshot policy is unhealthy:\n") + unhealthyPolicyCauses;

String unhealthyPolicyActions = unhealthyPolicies.stream()
.map(policy -> "- /_slm/policy/" + policy.getName() + "?human")
.map(policy -> "- /_slm/policy/" + policy.getPolicy().getId() + "?human")
.collect(Collectors.joining("\n"));
String action = "Check the snapshot lifecycle "
+ (unhealthyPolicies.size() > 1 ? "policies" : "policy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void testIsYellowWhenPoliciesHaveFailedForMoreThanWarningThreshold() {
+ "] repeated failures without successful execution since ["
+ FORMATTER.formatMillis(execTime)
+ "]",
"Check the snapshot lifecycle policy for detailed failure info:\n- /_slm/policy/test-policy?human"
"Check the snapshot lifecycle policy for detailed failure info:\n- /_slm/policy/policy-id?human"
),
List.of("test-policy")
)
Expand Down Expand Up @@ -302,7 +302,7 @@ private static Map<String, SnapshotLifecyclePolicyMetadata> createSlmPolicyWithI
return Map.of(
"test-policy",
SnapshotLifecyclePolicyMetadata.builder()
.setPolicy(new SnapshotLifecyclePolicy("id", "test-policy", "", "test-repository", null, null))
.setPolicy(new SnapshotLifecyclePolicy("policy-id", "test-policy", "", "test-repository", null, null))
.setVersion(1L)
.setModifiedDate(System.currentTimeMillis())
.setLastSuccess(lastSuccess)
Expand Down

0 comments on commit c240141

Please sign in to comment.