Skip to content

Commit c240141

Browse files
authored
SLM uneahlthy policies diagnosis recommends correct URL in action (#91506) (#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.
1 parent 610f39b commit c240141

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

docs/changelog/91506.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 91506
2+
summary: SLM uneahlthy policies diagnosis recommends correct URL in action
3+
area: Health
4+
type: bug
5+
issues: []

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/slm/SlmHealthIndicatorService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public HealthIndicatorResult calculate(boolean explain, HealthInfo healthInfo) {
159159
: "An automated snapshot policy is unhealthy:\n") + unhealthyPolicyCauses;
160160

161161
String unhealthyPolicyActions = unhealthyPolicies.stream()
162-
.map(policy -> "- /_slm/policy/" + policy.getName() + "?human")
162+
.map(policy -> "- /_slm/policy/" + policy.getPolicy().getId() + "?human")
163163
.collect(Collectors.joining("\n"));
164164
String action = "Check the snapshot lifecycle "
165165
+ (unhealthyPolicies.size() > 1 ? "policies" : "policy")

x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SlmHealthIndicatorServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public void testIsYellowWhenPoliciesHaveFailedForMoreThanWarningThreshold() {
222222
+ "] repeated failures without successful execution since ["
223223
+ FORMATTER.formatMillis(execTime)
224224
+ "]",
225-
"Check the snapshot lifecycle policy for detailed failure info:\n- /_slm/policy/test-policy?human"
225+
"Check the snapshot lifecycle policy for detailed failure info:\n- /_slm/policy/policy-id?human"
226226
),
227227
List.of("test-policy")
228228
)
@@ -302,7 +302,7 @@ private static Map<String, SnapshotLifecyclePolicyMetadata> createSlmPolicyWithI
302302
return Map.of(
303303
"test-policy",
304304
SnapshotLifecyclePolicyMetadata.builder()
305-
.setPolicy(new SnapshotLifecyclePolicy("id", "test-policy", "", "test-repository", null, null))
305+
.setPolicy(new SnapshotLifecyclePolicy("policy-id", "test-policy", "", "test-repository", null, null))
306306
.setVersion(1L)
307307
.setModifiedDate(System.currentTimeMillis())
308308
.setLastSuccess(lastSuccess)

0 commit comments

Comments
 (0)