[HealthAPI] Diagnosis: report typed affected resources#90653
[HealthAPI] Diagnosis: report typed affected resources#90653andreidan merged 11 commits intoelastic:mainfrom
Conversation
The health API reports the affected resources in case of an unhealthy
deployment. Until now all indicators reported one type of resource per
diagnosis (index, ILM policy, snapshot repository)
With the introduction of the disk indicator we now have an indicator
that reports multiple types of resources under the same diagnosis (ie.
nodes and indices).
This changes the structure of the `affected_resources` field to
accommodate multiple types of resources:
```
"affected_resources": {
"nodes": [
{
"id": "e1af6F5rTcmgpExkdOMzCg",
"name": "hot"
},
{
"id": "u_wBVl4ZRne4uZq_ziLsuw",
"name": "warm"
}
],
"indices": [
".geoip_databases",
"test_index"
]
}
```
|
Pinging @elastic/es-data-management (Team:Data Management) |
| return false; | ||
| } | ||
| Diagnosis diagnosis = (Diagnosis) o; | ||
| return definition.equals(diagnosis.definition) && Arrays.equals(affectedResources, diagnosis.affectedResources); |
There was a problem hiding this comment.
This Diagnosis equals/hashcode as otherwise records will be unique (unless an explicit array is passed in the constructor).
Not sure varargs are worth all this though?
|
@elasticmachine update branch |
|
Failure seems transient |
|
@elasticmachine run elasticsearch-ci/part-2 |
gmarouli
left a comment
There was a problem hiding this comment.
LGTM, thank you for picking this up! Some minor comments only :)
| for (DiscoveryNode node : nodes) { | ||
| builder.startObject(); | ||
| builder.field(ID_FIELD, node.getId()); | ||
| builder.field(NAME_FIELD, node.getName()); |
There was a problem hiding this comment.
Should we check here if name is null to omit it?
There was a problem hiding this comment.
Totally, great catch
| } | ||
| if (masterNodes.containsKey(HealthStatus.YELLOW)) { | ||
| diagnosisList.add(createNonDataNodeDiagnosis(HealthStatus.YELLOW, masterNodes.get(HealthStatus.YELLOW), true)); | ||
| List<DiscoveryNode> yellowMasterNodes = masterNodes.get(HealthStatus.YELLOW) |
There was a problem hiding this comment.
I am wondering if we should change the Set<DiscoveryNode> to a List<DiscoveryNode> and sort it in the constructor. I do not think the set is giving us anything now that I am thinking about it because we only encounter each node once in that for loop. What do you think?
There was a problem hiding this comment.
Ah yes, this is a great idea. Coming up
| List.of( | ||
| new Diagnosis( | ||
| DIAGNOSIS_WAIT_FOR_OR_FIX_DELAYED_SHARDS, | ||
| List.of(new Diagnosis.Resource(INDEX, List.of("restarting" + "-index"))) |
There was a problem hiding this comment.
I am guessing this wasn't intentional :).
There was a problem hiding this comment.
Hm, what exactly? The formatting? I ran spotless
| List.of( | ||
| new Diagnosis( | ||
| DIAGNOSIS_WAIT_FOR_OR_FIX_DELAYED_SHARDS, | ||
| List.of(new Diagnosis.Resource(INDEX, List.of("restarting" + "-index"))) |
|
Test failure is #90668 |
|
@elasticmachine run elasticsearch-ci/part-1 |
|
Test failure is transient |
|
@elasticmachine update branch |
💚 Backport successful
|
The health API reports the affected resources in case of an unhealthy
deployment. Until now all indicators reported one type of resource per
diagnosis (index, ILM policy, snapshot repository)
With the introduction of the disk indicator we now have an indicator
that reports multiple types of resources under the same diagnosis (ie.
nodes and indices).
This changes the structure of the `affected_resources` field to
accommodate multiple types of resources:
```
"affected_resources": {
"nodes": [
{
"id": "e1af6F5rTcmgpExkdOMzCg",
"name": "hot"
},
{
"id": "u_wBVl4ZRne4uZq_ziLsuw",
"name": "warm"
}
],
"indices": [
".geoip_databases",
"test_index"
]
}
```
…#90678) The health API reports the affected resources in case of an unhealthy deployment. Until now all indicators reported one type of resource per diagnosis (index, ILM policy, snapshot repository) With the introduction of the disk indicator we now have an indicator that reports multiple types of resources under the same diagnosis (ie. nodes and indices). This changes the structure of the `affected_resources` field to accommodate multiple types of resources: ``` "affected_resources": { "nodes": [ { "id": "e1af6F5rTcmgpExkdOMzCg", "name": "hot" }, { "id": "u_wBVl4ZRne4uZq_ziLsuw", "name": "warm" } ], "indices": [ ".geoip_databases", "test_index" ] } ```
…lastic#90653) (elastic#90678)" This reverts commit 7b4f2d2.
The health API reports the affected resources in case of an unhealthy deployment. Until now all indicators reported one type of resource per diagnosis (index, ILM policy, snapshot repository)
With the introduction of the disk indicator we now have an indicator that reports multiple types of resources under the same diagnosis (ie. nodes and indices).
This changes the structure of the
affected_resourcesfield to accommodate multiple types of resources:Fixes #90219