Skip to content
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

[8.5] [APM] Performance fix for 'cardinality' telemetry task (#144061) #144124

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,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 } } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const tasks: TelemetryTask[] = [
await search({
index: indices.transaction,
body: {
timeout,
query: {
bool: {
filter: [
Expand Down Expand Up @@ -354,6 +355,7 @@ export const tasks: TelemetryTask[] = [
const response = await search({
index: [indices.transaction],
body: {
timeout,
query: {
bool: {
filter: [{ range: { '@timestamp': { gte: 'now-1d' } } }],
Expand Down Expand Up @@ -1031,8 +1033,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,
Expand All @@ -1057,6 +1060,7 @@ export const tasks: TelemetryTask[] = [
});

const rumAgentCardinalityResponse = await search({
index: [indices.transaction],
body: {
size: 0,
timeout,
Expand Down