[APM] change span property name from child_ids to child.id (#64209)

This commit is contained in:
Cauê Marcondes 2020-04-23 12:16:49 +01:00 committed by GitHub
parent 4d979930aa
commit bb89b6a48c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View file

@ -191,7 +191,7 @@ describe('waterfall_helpers', () => {
name: 'SELECT FROM products',
id: 'mySpanIdB'
},
child_ids: ['mySpanIdA', 'mySpanIdC']
child: { id: ['mySpanIdA', 'mySpanIdC'] }
} as Span,
{
parent: { id: 'mySpanIdD' },
@ -294,7 +294,7 @@ describe('waterfall_helpers', () => {
name: 'SELECT FROM products',
id: 'mySpanIdB'
},
child_ids: ['incorrectId', 'mySpanIdC']
child: { id: ['incorrectId', 'mySpanIdC'] }
} as Span,
{
parent: { id: 'mySpanIdD' },

View file

@ -237,7 +237,7 @@ const getWaterfallItems = (items: TraceAPIResponse['trace']['items']) =>
});
/**
* Changes the parent_id of items based on the child_ids property.
* Changes the parent_id of items based on the child.id property.
* Solves the problem of Inferred spans that are created as child of trace spans
* when it actually should be its parent.
* @param waterfallItems
@ -245,10 +245,10 @@ const getWaterfallItems = (items: TraceAPIResponse['trace']['items']) =>
const reparentSpans = (waterfallItems: IWaterfallItem[]) => {
return waterfallItems.map(waterfallItem => {
if (waterfallItem.docType === 'span') {
const { child_ids: childIds } = waterfallItem.doc;
if (childIds) {
childIds.forEach(childId => {
const item = waterfallItems.find(_item => _item.id === childId);
const childId = waterfallItem.doc.child?.id;
if (childId) {
childId.forEach(id => {
const item = waterfallItems.find(_item => _item.id === id);
if (item) {
item.parentId = waterfallItem.id;
}

View file

@ -2027,7 +2027,7 @@ export const inferredSpans = {
id: '41226ae63af4f235',
type: 'unknown'
},
child_ids: ['8d80de06aa11a6fc']
child: { ids: ['8d80de06aa11a6fc'] }
},
{
container: {

View file

@ -52,5 +52,5 @@ export interface SpanRaw extends APMBaseDoc {
id: string;
};
observer?: Observer;
child_ids?: string[];
child?: { id: string[] };
}