mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[APM] Avoid accessing a non-existing index when bucket is empty (#58481)
* [APM] Avoid accessing a non-existing index when bucket is empty * Avoid invalid index access in get_service_node_metadata
This commit is contained in:
parent
2294748149
commit
b36a553b1c
2 changed files with 3 additions and 3 deletions
|
@ -58,8 +58,8 @@ export async function getServiceNodeMetadata({
|
|||
const response = await client.search(query);
|
||||
|
||||
return {
|
||||
host: response.aggregations?.host.buckets[0].key || NOT_AVAILABLE_LABEL,
|
||||
host: response.aggregations?.host.buckets[0]?.key || NOT_AVAILABLE_LABEL,
|
||||
containerId:
|
||||
response.aggregations?.containerId.buckets[0].key || NOT_AVAILABLE_LABEL
|
||||
response.aggregations?.containerId.buckets[0]?.key || NOT_AVAILABLE_LABEL
|
||||
};
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export async function getAgentNameByService({
|
|||
};
|
||||
|
||||
const { aggregations } = await client.search(params);
|
||||
const agentName = aggregations?.agent_names.buckets[0].key as
|
||||
const agentName = aggregations?.agent_names.buckets[0]?.key as
|
||||
| string
|
||||
| undefined;
|
||||
return { agentName };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue