Skip to content

Commit

Permalink
[APM] Immediately return terms for unbound queries
Browse files Browse the repository at this point in the history
Closes #73787.
  • Loading branch information
dgieselaar committed Aug 6, 2020
1 parent 13fd9e3 commit fab5944
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export async function getAllEnvironments({
],
},
body: {
...(!serviceNameFilter.length ? { timeout: '1ms' } : {}),
size: 0,
query: {
bool: {
Expand All @@ -48,6 +49,7 @@ export async function getAllEnvironments({
terms: {
field: SERVICE_ENVIRONMENT,
size: 100,
...(!serviceNameFilter.length ? { min_doc_count: 0 } : {}),
missing: includeMissing ? ENVIRONMENT_NOT_DEFINED : undefined,
},
},
Expand All @@ -56,6 +58,7 @@ export async function getAllEnvironments({
};

const resp = await apmEventClient.search(params);

const environments =
resp.aggregations?.environments.buckets.map(
(bucket) => bucket.key as string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function callClientWithDebug({
let res: any;
let esError = null;
try {
res = apiCaller(operationName, params);
res = await apiCaller(operationName, params);
} catch (e) {
// catch error and throw after outputting debug info
esError = e;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ export async function getServiceNames({ setup }: { setup: Setup }) {
],
},
body: {
timeout: '1ms',
size: 0,
aggs: {
services: {
terms: {
field: SERVICE_NAME,
size: 50,
min_doc_count: 0,
},
},
},
Expand Down

0 comments on commit fab5944

Please sign in to comment.