mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
parent
9b0fd8fa9c
commit
b7b4eed426
3 changed files with 17 additions and 22 deletions
|
@ -71,12 +71,9 @@ export const getDestinationMap = ({
|
|||
},
|
||||
aggs: {
|
||||
sample: {
|
||||
top_metrics: {
|
||||
metrics: [
|
||||
{ field: SPAN_TYPE },
|
||||
{ field: SPAN_SUBTYPE },
|
||||
{ field: SPAN_ID },
|
||||
] as const,
|
||||
top_hits: {
|
||||
size: 1,
|
||||
_source: [SPAN_TYPE, SPAN_SUBTYPE, SPAN_ID],
|
||||
sort: {
|
||||
'@timestamp': 'desc',
|
||||
},
|
||||
|
@ -91,15 +88,15 @@ export const getDestinationMap = ({
|
|||
|
||||
const outgoingConnections =
|
||||
response.aggregations?.connections.buckets.map((bucket) => {
|
||||
const fieldValues = bucket.sample.top[0].metrics;
|
||||
const sample = bucket.sample.hits.hits[0]._source;
|
||||
|
||||
return {
|
||||
[SPAN_DESTINATION_SERVICE_RESOURCE]: String(
|
||||
bucket.key[SPAN_DESTINATION_SERVICE_RESOURCE]
|
||||
),
|
||||
[SPAN_ID]: (fieldValues[SPAN_ID] ?? '') as string,
|
||||
[SPAN_TYPE]: (fieldValues[SPAN_TYPE] ?? '') as string,
|
||||
[SPAN_SUBTYPE]: (fieldValues[SPAN_SUBTYPE] ?? '') as string,
|
||||
[SPAN_ID]: sample.span.id,
|
||||
[SPAN_TYPE]: sample.span.type,
|
||||
[SPAN_SUBTYPE]: sample.span.subtype,
|
||||
};
|
||||
}) ?? [];
|
||||
|
||||
|
|
|
@ -115,11 +115,8 @@ export async function getBuckets({
|
|||
}),
|
||||
aggs: {
|
||||
samples: {
|
||||
top_metrics: {
|
||||
metrics: [
|
||||
{ field: TRANSACTION_ID },
|
||||
{ field: TRACE_ID },
|
||||
] as const,
|
||||
top_hits: {
|
||||
_source: [TRANSACTION_ID, TRACE_ID],
|
||||
size: 10,
|
||||
sort: {
|
||||
_score: 'desc',
|
||||
|
@ -135,11 +132,12 @@ export async function getBuckets({
|
|||
|
||||
return (
|
||||
response.aggregations?.distribution.buckets.map((bucket) => {
|
||||
const samples = bucket.samples.hits.hits;
|
||||
return {
|
||||
key: bucket.key,
|
||||
samples: bucket.samples.top.map((sample) => ({
|
||||
traceId: sample.metrics[TRACE_ID] as string,
|
||||
transactionId: sample.metrics[TRANSACTION_ID] as string,
|
||||
samples: samples.map(({ _source: sample }) => ({
|
||||
traceId: sample.trace.id,
|
||||
transactionId: sample.transaction.id,
|
||||
})),
|
||||
};
|
||||
}) ?? []
|
||||
|
|
|
@ -83,16 +83,16 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
.toMatchInline(`
|
||||
Array [
|
||||
Object {
|
||||
"traceId": "a4eb3781a21dc11d289293076fd1a1b3",
|
||||
"transactionId": "21892bde4ff1364d",
|
||||
"traceId": "af0f18dc0841cfc1f567e7e1d55cfda7",
|
||||
"transactionId": "925f02e5ac122897",
|
||||
},
|
||||
Object {
|
||||
"traceId": "ccd327537120e857bdfa407434dfb9a4",
|
||||
"transactionId": "c5f923159cc1b8a6",
|
||||
},
|
||||
Object {
|
||||
"traceId": "af0f18dc0841cfc1f567e7e1d55cfda7",
|
||||
"transactionId": "925f02e5ac122897",
|
||||
"traceId": "a4eb3781a21dc11d289293076fd1a1b3",
|
||||
"transactionId": "21892bde4ff1364d",
|
||||
},
|
||||
]
|
||||
`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue