forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Paginate big traces (elastic#165584)
- Loading branch information
Showing
24 changed files
with
807 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
.../ftr_e2e/cypress/e2e/transaction_details/large_trace_in_waterfall/generate_large_trace.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/no-shadow */ | ||
import { apm, timerange, DistributedTrace } from '@kbn/apm-synthtrace-client'; | ||
import { synthtrace } from '../../../../synthtrace'; | ||
|
||
const RATE_PER_MINUTE = 1; | ||
|
||
export function generateLargeTrace({ | ||
start, | ||
end, | ||
rootTransactionName, | ||
repeaterFactor, | ||
environment, | ||
}: { | ||
start: number; | ||
end: number; | ||
rootTransactionName: string; | ||
repeaterFactor: number; | ||
environment: string; | ||
}) { | ||
const range = timerange(start, end); | ||
|
||
const synthRum = apm | ||
.service({ name: 'synth-rum', environment, agentName: 'rum-js' }) | ||
.instance('my-instance'); | ||
|
||
const synthNode = apm | ||
.service({ name: 'synth-node', environment, agentName: 'nodejs' }) | ||
.instance('my-instance'); | ||
|
||
const synthGo = apm | ||
.service({ name: 'synth-go', environment, agentName: 'go' }) | ||
.instance('my-instance'); | ||
|
||
const synthDotnet = apm | ||
.service({ name: 'synth-dotnet', environment, agentName: 'dotnet' }) | ||
.instance('my-instance'); | ||
|
||
const synthJava = apm | ||
.service({ name: 'synth-java', environment, agentName: 'java' }) | ||
.instance('my-instance'); | ||
|
||
const traces = range.ratePerMinute(RATE_PER_MINUTE).generator((timestamp) => { | ||
return new DistributedTrace({ | ||
serviceInstance: synthRum, | ||
transactionName: rootTransactionName, | ||
timestamp, | ||
children: (_) => { | ||
_.service({ | ||
repeat: 5 * repeaterFactor, | ||
serviceInstance: synthNode, | ||
transactionName: 'GET /nodejs/products', | ||
latency: 100, | ||
|
||
children: (_) => { | ||
_.service({ | ||
serviceInstance: synthGo, | ||
transactionName: 'GET /go', | ||
children: (_) => { | ||
_.service({ | ||
repeat: 5 * repeaterFactor, | ||
serviceInstance: synthJava, | ||
transactionName: 'GET /java', | ||
children: (_) => { | ||
_.external({ | ||
name: 'GET telemetry.elastic.co', | ||
url: 'https://telemetry.elastic.co/ping', | ||
duration: 50, | ||
}); | ||
}, | ||
}); | ||
}, | ||
}); | ||
_.db({ | ||
name: 'GET apm-*/_search', | ||
type: 'elasticsearch', | ||
duration: 400, | ||
}); | ||
_.db({ name: 'GET', type: 'redis', duration: 500 }); | ||
_.db({ | ||
name: 'SELECT * FROM users', | ||
type: 'sqlite', | ||
duration: 600, | ||
}); | ||
}, | ||
}); | ||
|
||
_.service({ | ||
serviceInstance: synthNode, | ||
transactionName: 'GET /nodejs/users', | ||
latency: 100, | ||
repeat: 5 * repeaterFactor, | ||
children: (_) => { | ||
_.service({ | ||
serviceInstance: synthGo, | ||
transactionName: 'GET /go/security', | ||
latency: 50, | ||
children: (_) => { | ||
_.service({ | ||
repeat: 5 * repeaterFactor, | ||
serviceInstance: synthDotnet, | ||
transactionName: 'GET /dotnet/cases/4', | ||
latency: 50, | ||
children: (_) => | ||
_.db({ | ||
name: 'GET apm-*/_search', | ||
type: 'elasticsearch', | ||
duration: 600, | ||
statement: JSON.stringify( | ||
{ | ||
query: { | ||
query_string: { | ||
query: '(new york city) OR (big apple)', | ||
default_field: 'content', | ||
}, | ||
}, | ||
}, | ||
null, | ||
2 | ||
), | ||
}), | ||
}); | ||
}, | ||
}); | ||
}, | ||
}); | ||
}, | ||
}).getTransaction(); | ||
}); | ||
|
||
return synthtrace.index(traces); | ||
} |
80 changes: 80 additions & 0 deletions
80
.../cypress/e2e/transaction_details/large_trace_in_waterfall/large_traces_in_waterfall.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { synthtrace } from '../../../../synthtrace'; | ||
import { generateLargeTrace } from './generate_large_trace'; | ||
|
||
const start = '2021-10-10T00:00:00.000Z'; | ||
const end = '2021-10-10T00:01:00.000Z'; | ||
const rootTransactionName = `Large trace`; | ||
|
||
const timeRange = { rangeFrom: start, rangeTo: end }; | ||
|
||
describe('Large Trace in waterfall', () => { | ||
before(() => { | ||
synthtrace.clean(); | ||
|
||
generateLargeTrace({ | ||
start: new Date(start).getTime(), | ||
end: new Date(end).getTime(), | ||
rootTransactionName, | ||
repeaterFactor: 10, | ||
environment: 'large_trace', | ||
}); | ||
}); | ||
|
||
after(() => { | ||
synthtrace.clean(); | ||
}); | ||
|
||
describe('when navigating to a trace sample with default maxTraceItems', () => { | ||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
cy.visitKibana( | ||
`/app/apm/services/synth-rum/transactions/view?${new URLSearchParams({ | ||
...timeRange, | ||
transactionName: rootTransactionName, | ||
})}` | ||
); | ||
}); | ||
|
||
it('renders waterfall items', () => { | ||
cy.getByTestSubj('waterfallItem').should('have.length.greaterThan', 200); | ||
}); | ||
|
||
it('shows warning about trace size', () => { | ||
cy.getByTestSubj('apmWaterfallSizeWarning').should( | ||
'have.text', | ||
'The number of items in this trace is 15551 which is higher than the current limit of 5000. Please increase the limit via `xpack.apm.ui.maxTraceItems` to see the full trace' | ||
); | ||
}); | ||
}); | ||
|
||
describe('when navigating to a trace sample with maxTraceItems=20000', () => { | ||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
|
||
cy.intercept('GET', '/internal/apm/traces/**', (req) => { | ||
req.query.maxTraceItems = 20000; | ||
}).as('getTraces'); | ||
|
||
cy.visitKibana( | ||
`/app/apm/services/synth-rum/transactions/view?${new URLSearchParams({ | ||
...timeRange, | ||
transactionName: rootTransactionName, | ||
})}` | ||
); | ||
}); | ||
|
||
it('renders waterfall items', () => { | ||
cy.getByTestSubj('waterfallItem').should('have.length.greaterThan', 400); | ||
}); | ||
|
||
it('does not show the warning about trace size', () => { | ||
cy.getByTestSubj('apmWaterfallSizeWarning').should('not.exist'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.