Skip to content

Commit

Permalink
[8.x] [Infra] Use callback for logger.trace calls (#199805) (#200684)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Infra] Use callback for logger.trace calls
(#199805)](#199805)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dario
Gieselaar","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-19T08:51:55Z","message":"[Infra]
Use callback for logger.trace calls (#199805)\n\nUse a callback for
logger.trace() so big objects only get stringified\r\nwhen trace logging
is enabled.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"b8e6bbd4610b50169f1d19a0929d0db68aa82ad7","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-major","ci:project-deploy-observability","v8.17.0"],"title":"[Infra]
Use callback for logger.trace
calls","number":199805,"url":"https://github.com/elastic/kibana/pull/199805","mergeCommit":{"message":"[Infra]
Use callback for logger.trace calls (#199805)\n\nUse a callback for
logger.trace() so big objects only get stringified\r\nwhen trace logging
is enabled.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"b8e6bbd4610b50169f1d19a0929d0db68aa82ad7"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199805","number":199805,"mergeCommit":{"message":"[Infra]
Use callback for logger.trace calls (#199805)\n\nUse a callback for
logger.trace() so big objects only get stringified\r\nwhen trace logging
is enabled.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"b8e6bbd4610b50169f1d19a0929d0db68aa82ad7"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dario Gieselaar <[email protected]>
  • Loading branch information
kibanamachine and dgieselaar authored Nov 19, 2024
1 parent e4939a8 commit 99e3f67
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ export const getData = async (
customMetric,
fieldsExisted
);
logger.trace(`Request: ${JSON.stringify(request)}`);
logger.trace(() => `Request: ${JSON.stringify(request)}`);
const body = await esClient.search<undefined, ResponseAggregations>(request);
logger.trace(`Response: ${JSON.stringify(body)}`);
logger.trace(() => `Response: ${JSON.stringify(body)}`);
if (body.aggregations) {
return handleResponse(body.aggregations, previousNodes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export const checkMissingGroups = async (
];
});

logger.trace(`Request: ${JSON.stringify({ searches })}`);
logger.trace(() => `Request: ${JSON.stringify({ searches })}`);
const response = await esClient.msearch({ searches });
logger.trace(`Response: ${JSON.stringify(response)}`);
logger.trace(() => `Response: ${JSON.stringify(response)}`);

const verifiedMissingGroups = response.responses
.map((resp, index) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ export const getData = async (
fieldsExisted
),
};
logger.trace(`Request: ${JSON.stringify(request)}`);
logger.trace(() => `Request: ${JSON.stringify(request)}`);
const body = await esClient.search<undefined, ResponseAggregations>(request);
const { aggregations, _shards } = body;
logger.trace(`Response: ${JSON.stringify(body)}`);
logger.trace(() => `Response: ${JSON.stringify(body)}`);
if (aggregations) {
return handleResponse(aggregations, previousResults, _shards.successful);
} else if (_shards.successful) {
Expand Down

0 comments on commit 99e3f67

Please sign in to comment.