[scout] support log level override#228841
Conversation
| export async function ingestSynthtraceDataHook(config: FullConfig, data: SynthtraceIngestionData) { | ||
| const log = getLogger(); | ||
| const log = new ScoutLogger('scout: global hook', getScoutLogLevel()); |
There was a problem hiding this comment.
These functions are for parallel test run, that requires data ingestion to be done in advance.
| export function getLogger(workerContext: string = 'scout'): ScoutLogger { | ||
| if (!loggerInstances.has(workerContext)) { | ||
| loggerInstances.set(workerContext, new ScoutLogger(workerContext)); | ||
| function resolveLogLevel(envValue: string | undefined): LogLevel | undefined { |
There was a problem hiding this comment.
any chance we can move (the bulk of) this into new ToolingLog()?
There was a problem hiding this comment.
we'd end up with something like new ScoutLogger(loggerContext, process.env.SCOUT_PW_LOG_LEVEL) and then in the ToolingLog constructor we default to { level: process.env.LOG_LEVEL || 'info' } ?
There was a problem hiding this comment.
changed in 072146f , I added comment about priority and changed variable name to SCOUT_LOG_LEVEL because it has zero connection with the playwright internal logging (only our custom fixtures/hooks call it). cc @dolaru @dgieselaar
src/platform/packages/shared/kbn-scout/src/common/services/logger.ts
Outdated
Show resolved
Hide resolved
dolaru
left a comment
There was a problem hiding this comment.
LGTM 👍🏽
Just one nit in one of the code comments.
src/platform/packages/shared/kbn-scout/src/playwright/fixtures/worker/core_fixtures.ts
Outdated
Show resolved
Hide resolved
…/worker/core_fixtures.ts Co-authored-by: David Olaru <dolaru@vaevixen.com>
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Public APIs missing comments
Unknown metric groupsAPI count
History
cc @dmlemeshko |
| }); | ||
| // Temporarily use `debug` log level for Playwright tests to better understand performance issues; | ||
| // We are going to change it to `info` in the future. This change doesn't affect Test Servers logging. | ||
| const logsLevel = pickLevelFromFlags(globalFlags, { default: 'debug' }); |
There was a problem hiding this comment.
does this need to default to debug? for whom are these debug logs useful atm?
There was a problem hiding this comment.
Mostly for appex-qa to evaluate parallel testing with Kibana spaces and spot some slow API calls. If we see a repetitive API calls taking 10 seconds to setup env, we usually ask to consider improvement. The end goal is not only move to playwright, but finally start writing stable, fast and reliable tests.
mistic
left a comment
There was a problem hiding this comment.
After the fact we might want to summarise our logging ideas we discussed async so this can become a standard in the codebase. LGTM
|
Starting backport for target branches: 8.19, 9.1 https://github.com/elastic/kibana/actions/runs/16454773113 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
## Summary - default log level for Playwright fixtures is `info` , afaik default for FTR and other scripts (but for now to better understand performance issues we pass `debug` through `node scripts/scout`, to be reverted for GA) - `node scripts/scout` will propagate log level from cli flag (e.g. --debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command - since some Team may not use `scripts/scout` command, they can set `LOG_LEVEL` variable to override to whatever level is needed if both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has priority (important for us, shouldn't block others) ### Playwright Integration: * Replaced the use of `getLogger` with the updated `ScoutLogger` call in Playwright worker fixtures, enabling log level configuration via environment variables. * Modified the Playwright test runner to propagate the log level to the test environment using the `SCOUT_LOG_LEVEL` variable. --------- Co-authored-by: David Olaru <dolaru@vaevixen.com>
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
## Summary - default log level for Playwright fixtures is `info` , afaik default for FTR and other scripts (but for now to better understand performance issues we pass `debug` through `node scripts/scout`, to be reverted for GA) - `node scripts/scout` will propagate log level from cli flag (e.g. --debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command - since some Team may not use `scripts/scout` command, they can set `LOG_LEVEL` variable to override to whatever level is needed if both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has priority (important for us, shouldn't block others) ### Playwright Integration: * Replaced the use of `getLogger` with the updated `ScoutLogger` call in Playwright worker fixtures, enabling log level configuration via environment variables. * Modified the Playwright test runner to propagate the log level to the test environment using the `SCOUT_LOG_LEVEL` variable. --------- Co-authored-by: David Olaru <dolaru@vaevixen.com> (cherry picked from commit d76a5be) # Conflicts: # src/platform/packages/shared/kbn-scout/src/playwright/global_hooks/synthtrace_ingestion.ts
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `9.1`: - [[scout] support log level override (#228841)](#228841) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dzmitry Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-07-22T20:25:49Z","message":"[scout] support log level override (#228841)\n\n## Summary\n\n- default log level for Playwright fixtures is `info` , afaik default\nfor FTR and other scripts (but for now to better understand performance\nissues we pass `debug` through `node scripts/scout`, to be reverted for\nGA)\n- `node scripts/scout` will propagate log level from cli flag (e.g.\n--debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command\n- since some Team may not use `scripts/scout` command, they can set\n`LOG_LEVEL` variable to override to whatever level is needed\nif both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has\npriority (important for us, shouldn't block others)\n\n### Playwright Integration:\n* Replaced the use of `getLogger` with the updated `ScoutLogger` call in\nPlaywright worker fixtures, enabling log level configuration via\nenvironment variables.\n* Modified the Playwright test runner to propagate the log level to the\ntest environment using the `SCOUT_LOG_LEVEL` variable.\n\n---------\n\nCo-authored-by: David Olaru <dolaru@vaevixen.com>","sha":"d76a5befa5ec73425b44c10b24f66a19556a7e83","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","backport:version","v9.1.0","v8.19.0","ci:scout-ui-tests","v9.2.0"],"title":"[scout] support log level override","number":228841,"url":"https://github.com/elastic/kibana/pull/228841","mergeCommit":{"message":"[scout] support log level override (#228841)\n\n## Summary\n\n- default log level for Playwright fixtures is `info` , afaik default\nfor FTR and other scripts (but for now to better understand performance\nissues we pass `debug` through `node scripts/scout`, to be reverted for\nGA)\n- `node scripts/scout` will propagate log level from cli flag (e.g.\n--debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command\n- since some Team may not use `scripts/scout` command, they can set\n`LOG_LEVEL` variable to override to whatever level is needed\nif both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has\npriority (important for us, shouldn't block others)\n\n### Playwright Integration:\n* Replaced the use of `getLogger` with the updated `ScoutLogger` call in\nPlaywright worker fixtures, enabling log level configuration via\nenvironment variables.\n* Modified the Playwright test runner to propagate the log level to the\ntest environment using the `SCOUT_LOG_LEVEL` variable.\n\n---------\n\nCo-authored-by: David Olaru <dolaru@vaevixen.com>","sha":"d76a5befa5ec73425b44c10b24f66a19556a7e83"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/228841","number":228841,"mergeCommit":{"message":"[scout] support log level override (#228841)\n\n## Summary\n\n- default log level for Playwright fixtures is `info` , afaik default\nfor FTR and other scripts (but for now to better understand performance\nissues we pass `debug` through `node scripts/scout`, to be reverted for\nGA)\n- `node scripts/scout` will propagate log level from cli flag (e.g.\n--debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command\n- since some Team may not use `scripts/scout` command, they can set\n`LOG_LEVEL` variable to override to whatever level is needed\nif both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has\npriority (important for us, shouldn't block others)\n\n### Playwright Integration:\n* Replaced the use of `getLogger` with the updated `ScoutLogger` call in\nPlaywright worker fixtures, enabling log level configuration via\nenvironment variables.\n* Modified the Playwright test runner to propagate the log level to the\ntest environment using the `SCOUT_LOG_LEVEL` variable.\n\n---------\n\nCo-authored-by: David Olaru <dolaru@vaevixen.com>","sha":"d76a5befa5ec73425b44c10b24f66a19556a7e83"}}]}] BACKPORT-->
## Summary - default log level for Playwright fixtures is `info` , afaik default for FTR and other scripts (but for now to better understand performance issues we pass `debug` through `node scripts/scout`, to be reverted for GA) - `node scripts/scout` will propagate log level from cli flag (e.g. --debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command - since some Team may not use `scripts/scout` command, they can set `LOG_LEVEL` variable to override to whatever level is needed if both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has priority (important for us, shouldn't block others) ### Playwright Integration: * Replaced the use of `getLogger` with the updated `ScoutLogger` call in Playwright worker fixtures, enabling log level configuration via environment variables. * Modified the Playwright test runner to propagate the log level to the test environment using the `SCOUT_LOG_LEVEL` variable. --------- Co-authored-by: David Olaru <dolaru@vaevixen.com> (cherry picked from commit d76a5be) # Conflicts: # src/platform/packages/shared/kbn-scout/src/playwright/global_hooks/synthtrace_ingestion.ts
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.19`: - [[scout] support log level override (#228841)](#228841) <!--- Backport version: 10.0.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dzmitry Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-07-22T20:25:49Z","message":"[scout] support log level override (#228841)\n\n## Summary\n\n- default log level for Playwright fixtures is `info` , afaik default\nfor FTR and other scripts (but for now to better understand performance\nissues we pass `debug` through `node scripts/scout`, to be reverted for\nGA)\n- `node scripts/scout` will propagate log level from cli flag (e.g.\n--debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command\n- since some Team may not use `scripts/scout` command, they can set\n`LOG_LEVEL` variable to override to whatever level is needed\nif both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has\npriority (important for us, shouldn't block others)\n\n### Playwright Integration:\n* Replaced the use of `getLogger` with the updated `ScoutLogger` call in\nPlaywright worker fixtures, enabling log level configuration via\nenvironment variables.\n* Modified the Playwright test runner to propagate the log level to the\ntest environment using the `SCOUT_LOG_LEVEL` variable.\n\n---------\n\nCo-authored-by: David Olaru <dolaru@vaevixen.com>","sha":"d76a5befa5ec73425b44c10b24f66a19556a7e83","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v8.19.0","ci:scout-ui-tests","v9.2.0","v9.1.1"],"title":"[scout] support log level override","number":228841,"url":"https://github.com/elastic/kibana/pull/228841","mergeCommit":{"message":"[scout] support log level override (#228841)\n\n## Summary\n\n- default log level for Playwright fixtures is `info` , afaik default\nfor FTR and other scripts (but for now to better understand performance\nissues we pass `debug` through `node scripts/scout`, to be reverted for\nGA)\n- `node scripts/scout` will propagate log level from cli flag (e.g.\n--debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command\n- since some Team may not use `scripts/scout` command, they can set\n`LOG_LEVEL` variable to override to whatever level is needed\nif both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has\npriority (important for us, shouldn't block others)\n\n### Playwright Integration:\n* Replaced the use of `getLogger` with the updated `ScoutLogger` call in\nPlaywright worker fixtures, enabling log level configuration via\nenvironment variables.\n* Modified the Playwright test runner to propagate the log level to the\ntest environment using the `SCOUT_LOG_LEVEL` variable.\n\n---------\n\nCo-authored-by: David Olaru <dolaru@vaevixen.com>","sha":"d76a5befa5ec73425b44c10b24f66a19556a7e83"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/228841","number":228841,"mergeCommit":{"message":"[scout] support log level override (#228841)\n\n## Summary\n\n- default log level for Playwright fixtures is `info` , afaik default\nfor FTR and other scripts (but for now to better understand performance\nissues we pass `debug` through `node scripts/scout`, to be reverted for\nGA)\n- `node scripts/scout` will propagate log level from cli flag (e.g.\n--debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command\n- since some Team may not use `scripts/scout` command, they can set\n`LOG_LEVEL` variable to override to whatever level is needed\nif both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has\npriority (important for us, shouldn't block others)\n\n### Playwright Integration:\n* Replaced the use of `getLogger` with the updated `ScoutLogger` call in\nPlaywright worker fixtures, enabling log level configuration via\nenvironment variables.\n* Modified the Playwright test runner to propagate the log level to the\ntest environment using the `SCOUT_LOG_LEVEL` variable.\n\n---------\n\nCo-authored-by: David Olaru <dolaru@vaevixen.com>","sha":"d76a5befa5ec73425b44c10b24f66a19556a7e83"}},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/229557","number":229557,"state":"MERGED","mergeCommit":{"sha":"1de8c338657942a87ceaa249b3a220a2ec26af92","message":"[9.1] [scout] support log level override (#228841) (#229557)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.1`:\n- [[scout] support log level override\n(#228841)](https://github.com/elastic/kibana/pull/228841)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n"}}]}] BACKPORT-->
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary - default log level for Playwright fixtures is `info` , afaik default for FTR and other scripts (but for now to better understand performance issues we pass `debug` through `node scripts/scout`, to be reverted for GA) - `node scripts/scout` will propagate log level from cli flag (e.g. --debug) with `SCOUT_LOG_LEVEL` env variable to playwright exec command - since some Team may not use `scripts/scout` command, they can set `LOG_LEVEL` variable to override to whatever level is needed if both `LOG_LEVEL` and `SCOUT_LOG_LEVEL` are set, the later has priority (important for us, shouldn't block others) ### Playwright Integration: * Replaced the use of `getLogger` with the updated `ScoutLogger` call in Playwright worker fixtures, enabling log level configuration via environment variables. * Modified the Playwright test runner to propagate the log level to the test environment using the `SCOUT_LOG_LEVEL` variable. --------- Co-authored-by: David Olaru <dolaru@vaevixen.com> (cherry picked from commit d76a5be) # Conflicts: # src/platform/packages/shared/kbn-scout/src/playwright/global_hooks/synthtrace_ingestion.ts
Summary
info, afaik default for FTR and other scripts (but for now to better understand performance issues we passdebugthroughnode scripts/scout, to be reverted for GA)node scripts/scoutwill propagate log level from cli flag (e.g. --debug) withSCOUT_LOG_LEVELenv variable to playwright exec commandscripts/scoutcommand, they can setLOG_LEVELvariable to override to whatever level is neededif both
LOG_LEVELandSCOUT_LOG_LEVELare set, the later has priority (important for us, shouldn't block others)Playwright Integration:
getLoggerwith the updatedScoutLoggercall in Playwright worker fixtures, enabling log level configuration via environment variables.SCOUT_LOG_LEVELvariable.