Skip to content

Commit

Permalink
[Uptime] Fix regression in logging queries on inspect (#117124) (#117908
Browse files Browse the repository at this point in the history
)

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Shahzad <[email protected]>
  • Loading branch information
kibanamachine and shahzad31 authored Nov 9, 2021
1 parent d5a4c4b commit d2b4da9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions x-pack/plugins/uptime/server/lib/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export function createUptimeESClient({
request?: KibanaRequest;
savedObjectsClient: SavedObjectsClientContract | ISavedObjectsRepository;
}) {
const { _inspect = false } = (request?.query as { _inspect: boolean }) ?? {};

return {
baseESClient: esClient,
async search<DocumentSource extends unknown, TParams extends estypes.SearchRequest>(
Expand Down Expand Up @@ -101,10 +99,9 @@ export function createUptimeESClient({
startTime: startTimeNow,
})
);
}

if (_inspect && request) {
debugESCall({ startTime, request, esError, operationName: 'search', params: esParams });
if (request) {
debugESCall({ startTime, request, esError, operationName: 'search', params: esParams });
}
}

if (esError) {
Expand All @@ -129,8 +126,9 @@ export function createUptimeESClient({
} catch (e) {
esError = e;
}
const inspectableEsQueries = inspectableEsQueriesMap.get(request!);

if (_inspect && request) {
if (inspectableEsQueries && request) {
debugESCall({ startTime, request, esError, operationName: 'count', params: esParams });
}

Expand Down

0 comments on commit d2b4da9

Please sign in to comment.