mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[APM] Performance fix for 'cardinality' telemetry task (#144061)
* Performance fix for 'cardinality' telemetry task * Make timeout/index required for telemetry searches * Fix tests Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
This commit is contained in:
parent
756916db3f
commit
a5c8ebe00d
3 changed files with 11 additions and 3 deletions
|
@ -17,7 +17,11 @@ type ISavedObjectsClient = Pick<SavedObjectsClient, 'find'>;
|
|||
|
||||
type TelemetryTaskExecutor = (params: {
|
||||
indices: ApmIndicesConfig;
|
||||
search<TSearchRequest extends ESSearchRequest>(
|
||||
search<
|
||||
TSearchRequest extends ESSearchRequest & { index: string | string[] } & {
|
||||
body: { timeout: string };
|
||||
}
|
||||
>(
|
||||
params: TSearchRequest
|
||||
): Promise<ESSearchResponse<unknown, TSearchRequest>>;
|
||||
indicesStats(
|
||||
|
|
|
@ -434,7 +434,7 @@ describe('data telemetry collection tasks', () => {
|
|||
}
|
||||
});
|
||||
|
||||
expect(await task?.executor({ search } as any)).toEqual({
|
||||
expect(await task?.executor({ search, indices } as any)).toEqual({
|
||||
cardinality: {
|
||||
client: { geo: { country_iso_code: { rum: { '1d': 5 } } } },
|
||||
transaction: { name: { all_agents: { '1d': 3 }, rum: { '1d': 1 } } },
|
||||
|
|
|
@ -148,6 +148,7 @@ export const tasks: TelemetryTask[] = [
|
|||
await search({
|
||||
index: indices.transaction,
|
||||
body: {
|
||||
timeout,
|
||||
query: {
|
||||
bool: {
|
||||
filter: [
|
||||
|
@ -355,6 +356,7 @@ export const tasks: TelemetryTask[] = [
|
|||
const response = await search({
|
||||
index: [indices.transaction],
|
||||
body: {
|
||||
timeout,
|
||||
query: {
|
||||
bool: {
|
||||
filter: [{ range: { '@timestamp': { gte: 'now-1d' } } }],
|
||||
|
@ -1032,8 +1034,9 @@ export const tasks: TelemetryTask[] = [
|
|||
},
|
||||
{
|
||||
name: 'cardinality',
|
||||
executor: async ({ search }) => {
|
||||
executor: async ({ indices, search }) => {
|
||||
const allAgentsCardinalityResponse = await search({
|
||||
index: [indices.transaction],
|
||||
body: {
|
||||
size: 0,
|
||||
timeout,
|
||||
|
@ -1058,6 +1061,7 @@ export const tasks: TelemetryTask[] = [
|
|||
});
|
||||
|
||||
const rumAgentCardinalityResponse = await search({
|
||||
index: [indices.transaction],
|
||||
body: {
|
||||
size: 0,
|
||||
timeout,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue