-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APM][OTel] Ensure Errors views works with OTel Data #9
Changes from 4 commits
f9ccf34
71cfaad
e50cf41
4a11176
ee8ceda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
*/ | ||
|
||
import { rangeQuery, kqlQuery } from '@kbn/observability-plugin/server'; | ||
import { normalizeValue } from '../../../utils/es_fields_mappings/es_fields_mappings_helpers'; | ||
import { asMutableArray } from '../../../../common/utils/as_mutable_array'; | ||
import { | ||
ERROR_GROUP_ID, | ||
|
@@ -66,16 +67,18 @@ export async function getErrorGroupSampleIds({ | |
should: [{ term: { [TRANSACTION_SAMPLED]: true } }], // prefer error samples with related transactions | ||
}, | ||
}, | ||
_source: [ERROR_ID, 'transaction'], | ||
fields: [ERROR_ID], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm not mistaken, the 'transaction' was added for the scoring, so I think the field |
||
sort: asMutableArray([ | ||
{ _score: { order: 'desc' } }, // sort by _score first to ensure that errors with transaction.sampled:true ends up on top | ||
{ '@timestamp': { order: 'desc' } }, // sort by timestamp to get the most recent error | ||
] as const), | ||
}, | ||
}); | ||
const errorSampleIds = resp.hits.hits.map((item) => { | ||
const source = item._source; | ||
return source?.error?.id; | ||
const fields = item.fields; | ||
const errorId = normalizeValue<string>(fields?.['error.id']); | ||
|
||
return errorId; | ||
}); | ||
|
||
return { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Optional chaining is only needed for
normalizedFields
. If the object is not undefined, then the rest is defined