mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.10] [Observability AI Assistant] Return errorDoc
instead of error
in GetApmErrorDocument function (#165588) (#165601)
# Backport This will backport the following commits from `main` to `8.10`: - [[Observability AI Assistant] Return `errorDoc` instead of `error` in GetApmErrorDocument function (#165588)](https://github.com/elastic/kibana/pull/165588) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Coen Warmer","email":"coen.warmer@gmail.com"},"sourceCommit":{"committedDate":"2023-09-04T13:49:48Z","message":"[Observability AI Assistant] Return `errorDoc` instead of `error` in GetApmErrorDocument function (#165588)","sha":"046cfc854dfbcf946d775c8f204b0a2c74414cd6","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:APM","release_note:skip","backport:prev-minor","v8.10.0","v8.11.0"],"number":165588,"url":"https://github.com/elastic/kibana/pull/165588","mergeCommit":{"message":"[Observability AI Assistant] Return `errorDoc` instead of `error` in GetApmErrorDocument function (#165588)","sha":"046cfc854dfbcf946d775c8f204b0a2c74414cd6"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165588","number":165588,"mergeCommit":{"message":"[Observability AI Assistant] Return `errorDoc` instead of `error` in GetApmErrorDocument function (#165588)","sha":"046cfc854dfbcf946d775c8f204b0a2c74414cd6"}}]}] BACKPORT--> Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
This commit is contained in:
parent
18cfd84a54
commit
0e0846a3b3
1 changed files with 11 additions and 4 deletions
|
@ -54,14 +54,14 @@ export async function getApmErrorDocument({
|
|||
},
|
||||
});
|
||||
|
||||
const error = response.hits.hits[0]?._source as APMError;
|
||||
const errorDoc = response.hits.hits[0]?._source as APMError;
|
||||
|
||||
if (!error) {
|
||||
if (!errorDoc) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return pick(
|
||||
error,
|
||||
const formattedResponse = pick(
|
||||
errorDoc,
|
||||
'message',
|
||||
'error',
|
||||
'@timestamp',
|
||||
|
@ -71,4 +71,11 @@ export async function getApmErrorDocument({
|
|||
'span.type',
|
||||
'span.subtype'
|
||||
);
|
||||
|
||||
const { error, ...rest } = formattedResponse;
|
||||
|
||||
return {
|
||||
...rest,
|
||||
errorDoc: formattedResponse.error,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue