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

[APM] Add range query to terms enum call #162614

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 @@ -112,12 +112,14 @@ export function ServicesTable() {
environment,
kuery,
indexLifecyclePhase,
start,
end,
},
},
});
}
},
[environment, kuery, indexLifecyclePhase, useOptimizedSorting]
[useOptimizedSorting, environment, kuery, indexLifecyclePhase, start, end]
);

const serviceStatisticsFetch = useProgressiveFetcher(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ export async function getServiceNamesFromTermsEnum({
apmEventClient,
environment,
maxNumberOfServices,
start,
end,
}: {
apmEventClient: APMEventClient;
environment: Environment;
maxNumberOfServices: number;
start: number;
end: number;
}) {
if (environment !== ENVIRONMENT_ALL.value) {
return [];
Expand All @@ -36,6 +40,15 @@ export async function getServiceNamesFromTermsEnum({
},
size: maxNumberOfServices,
field: SERVICE_NAME,
index_filter: {
range: {
['@timestamp']: {
gte: start,
lte: end,
format: 'epoch_millis',
},
},
},
}
);

Expand Down
11 changes: 9 additions & 2 deletions x-pack/plugins/apm/server/routes/storage_explorer/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,12 @@ const storageExplorerGetServices = createApmServerRoute({
tags: ['access:apm'],
},
params: t.type({
query: t.intersection([indexLifecyclePhaseRt, environmentRt, kueryRt]),
query: t.intersection([
indexLifecyclePhaseRt,
environmentRt,
kueryRt,
rangeRt,
]),
}),
handler: async (
resources
Expand All @@ -333,7 +338,7 @@ const storageExplorerGetServices = createApmServerRoute({
}>;
}> => {
const {
query: { environment, kuery, indexLifecyclePhase },
query: { environment, kuery, indexLifecyclePhase, start, end },
} = resources.params;

if (
Expand All @@ -352,6 +357,8 @@ const storageExplorerGetServices = createApmServerRoute({
apmEventClient,
environment,
maxNumberOfServices: 500,
start,
end,
});

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
environment,
kuery,
indexLifecyclePhase,
start,
end,
},
},
});
Expand Down