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

Add logging to importer. Closes issue #192212 #192234

Merged
merged 5 commits into from
Oct 8, 2024

Conversation

kyracho
Copy link
Contributor

@kyracho kyracho commented Sep 6, 2024

Summary

Hello, this closes issue #192212 by adding a custom logger to the importer, making debugging issues easier.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@kyracho kyracho requested a review from a team as a code owner September 6, 2024 03:36
Copy link

cla-checker-service bot commented Sep 6, 2024

💚 CLA has been signed

@kyracho
Copy link
Contributor Author

kyracho commented Sep 6, 2024

Hello, I’ve now signed the contributor agreement, which covers the commit b523e16.

@kyracho
Copy link
Contributor Author

kyracho commented Sep 7, 2024

Hello, I wanted to kindly request that someone with the necessary permissions add the release note label to this pull request. Unfortunately, I don't have the authority to apply labels, and it seems the label is required to pass the CI test. Thanks in advance for your assistance.

@TinaHeiligers TinaHeiligers added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Oct 3, 2024
@TinaHeiligers
Copy link
Contributor

@elasticmachine merge upstream

@kyracho kyracho force-pushed the add-logging-to-importer branch from ebc0ea8 to 39df481 Compare October 3, 2024 17:35
@TinaHeiligers
Copy link
Contributor

TinaHeiligers commented Oct 3, 2024

@kyracho thank you for your PR! I added the required labels and updated your branch.

Adding the logger to the Saved Objects Service won't automatically instrument logging,
The logger must be passed to the SavedObjectsImporter class and used in the import and resolveImportErrors APIs. The types, unit tests, and integration tests also need updates.
See SavedObjectsExporter for how that's done.

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the logger to the Saved Objects Service won't automatically instrument logging.

The logger must be passed to the SavedObjectsImporter class and used in the import and resolveImportErrors APIs. The types, unit tests, and integration tests also need updates.

@TinaHeiligers
Copy link
Contributor

@elasticmachine merge upstream

@kyracho kyracho requested review from a team as code owners October 3, 2024 22:10
@botelastic botelastic bot added ci:project-deploy-observability Create an Observability project Team:Fleet Team label for Observability Data Collection Fleet team labels Oct 3, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@kyracho kyracho force-pushed the add-logging-to-importer branch from b75eb81 to 61137bc Compare October 3, 2024 22:12
@TinaHeiligers
Copy link
Contributor

@kyracho the forced pushes don't start CI. Please request us to run CI on your behalf.

@TinaHeiligers
Copy link
Contributor

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

There are no new commits on the base branch.

@TinaHeiligers
Copy link
Contributor

TinaHeiligers commented Oct 4, 2024

@kyracho you're probably facing the rebase nightmare by now. It would be a good idea to update your fork of Kibana and keep that up to date with your local clone. Don't rebase anymore, merge updates instead.
git and source control can take some getting used to, we've all been there

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import reads from a stream and awaiting the call (and other related function calls) can cause Kibana to OOM.

Logging doesn't warrant the risks of Kibana running out of memory.

});
this.#log.debug('Starting the import process');
try {
const result = await importSavedObjectsFromStream({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awaiting a resolved promise from importSavedObjectsFromStream is a problem when importing many saved objects and can cause Kibana to run out of memory.
import shouldn't await on importSavedObjectsFromStream, we have to stick with calling the method directly.

I'd rather move the log line to before returning importSavedObjectsFromStream and revert the other changes here,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See node streams for more info

}

public resolveImportErrors({
public async resolveImportErrors({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't 'simply' change this....

});
this.#log.debug('Resolving import errors');
try {
const result = await resolveSavedObjectsImportErrors({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar comment as for importSavedObjectsFromStream

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import reads from a stream and awaiting the call (and other related function calls) can cause Kibana to OOM.

Logging doesn't warrant the risks of Kibana running out of memory.

@kyracho
Copy link
Contributor Author

kyracho commented Oct 5, 2024

@TinaHeiligers Thanks for the guidance! I’ve made the following changes in response to your comments:

  • Removed await from importSavedObjectsFromStream and resolveSavedObjectsImportErrors to prevent memory issues.
  • Moved the log statements to occur before the return statements, as you suggested
  • Returned the promises directly
  • Removed the async keywords from the methods

Let me know if anything else is needed!

@TinaHeiligers
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds simplistic logging.
We need to enhance the logs with information on the saved objects being imported, how they are imported and if there are any errors. The enhancements can be a follow up to this PR.

@TinaHeiligers
Copy link
Contributor

buildkite test this

@kyracho
Copy link
Contributor Author

kyracho commented Oct 7, 2024

Thanks, Tina! I'd be happy to work on those enhancements in a new PR if that's okay. Please let me know if you'd like me to take it on.

@TinaHeiligers
Copy link
Contributor

buildkite test this

@TinaHeiligers
Copy link
Contributor

Thanks, Tina! I'd be happy to work on those enhancements in a new PR if that's okay. Please let me know if you'd like me to take it on.

The idea is to use the logs for debugging, similar to how we log info during export.
Take a look at what we log for export with the following config to your kibana.dev.yml:

logging:
  appenders:
    so-console: // or use whatever you prefer
      type: console
      layout:
        type: pattern
        highlight: true
        pattern: "SOS_IMPEXP--[%date][%level][%logger]---%message"
  root:
    appenders: [console]
    level: info
  loggers:
    - name: savedobjects-service.exporter
      level: all
      appenders: [so-console] // feel free to change this
    - name: savedobjects-service.importer
      level: all
      appenders: [so-console] // feel free to change this

FYI: the appender is one I prefer to use, you can use whatever you want

Start es
Start kibana in dev (any license is fine)
Once kibana's running, add any sample data. Adding sample data uses Saved Objects import (the logs you're adding here)
Navigate to the Saved Objects Management page and export anything from there (or all of them)
Watch the terminal you started Kibana from. The logs will be there as stdout

@TinaHeiligers TinaHeiligers enabled auto-merge (squash) October 7, 2024 23:52
@TinaHeiligers TinaHeiligers merged commit c36a894 into elastic:main Oct 8, 2024
24 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11227177901

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 8, 2024
## Summary
Hello, this closes issue elastic#192212 by adding a custom logger to the
importer, making debugging issues easier.
### Checklist

Delete any items that are not applicable to this PR.

- [N/A] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [N/A]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios TODO
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed TODO
- [N/A] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [N/A] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [N/A] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [N/A] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [N/A] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [X] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
(no API changes)

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit c36a894)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 8, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [Add logging to importer. Closes issue #192212
(#192234)](#192234)

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

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

<!--BACKPORT [{"author":{"name":"Kyra
Cho","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-08T01:58:32Z","message":"Add
logging to importer. Closes issue #192212 (#192234)\n\n##
Summary\r\nHello, this closes issue #192212 by adding a custom logger to
the\r\nimporter, making debugging issues easier.\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [N/A] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[N/A]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios TODO\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed TODO\r\n- [N/A] Any UI touched in this
PR is usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [N/A] Any
UI touched in this PR does not create any new axe failures\r\n(run axe
in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[N/A] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[N/A] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[N/A] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
For maintainers\r\n\r\n- [X] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n(no
API changes)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"c36a8943982b92afd593a521d5a0bf2de06deb01","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","💝community","v9.0.0","backport:prev-minor","v8.16.0"],"title":"Add
logging to importer. Closes issue
#192212","number":192234,"url":"https://github.com/elastic/kibana/pull/192234","mergeCommit":{"message":"Add
logging to importer. Closes issue #192212 (#192234)\n\n##
Summary\r\nHello, this closes issue #192212 by adding a custom logger to
the\r\nimporter, making debugging issues easier.\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [N/A] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[N/A]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios TODO\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed TODO\r\n- [N/A] Any UI touched in this
PR is usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [N/A] Any
UI touched in this PR does not create any new axe failures\r\n(run axe
in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[N/A] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[N/A] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[N/A] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
For maintainers\r\n\r\n- [X] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n(no
API changes)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"c36a8943982b92afd593a521d5a0bf2de06deb01"}},"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/192234","number":192234,"mergeCommit":{"message":"Add
logging to importer. Closes issue #192212 (#192234)\n\n##
Summary\r\nHello, this closes issue #192212 by adding a custom logger to
the\r\nimporter, making debugging issues easier.\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [N/A] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[N/A]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios TODO\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed TODO\r\n- [N/A] Any UI touched in this
PR is usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [N/A] Any
UI touched in this PR does not create any new axe failures\r\n(run axe
in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[N/A] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[N/A] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[N/A] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
For maintainers\r\n\r\n- [X] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n(no
API changes)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"c36a8943982b92afd593a521d5a0bf2de06deb01"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Kyra Cho <[email protected]>
@kyracho kyracho deleted the add-logging-to-importer branch October 11, 2024 20:49
TinaHeiligers pushed a commit that referenced this pull request Nov 1, 2024
## Summary
Hello, this is a follow up PR to #192234 . The previous PR added
simplistic logging to the saved objects importer. The goal now is to
enhance the logs with information on the saved objects being imported,
how they are imported, and by displaying any errors.

#### `import_saved_objects.ts`:
- Logs specific types being imported
- Logs size limit and overwrite status
- Logs Success/Fail messages

#### Changes to `saved_objects_importer.ts`:
- Passes the logger to `importSavedObjectsFromStream` 
- Removes "starting import"

#### Changes to `import_saved_objects.test.ts`:
- Updates it for the new logger parameter

#### Changes to `import.test.ts`:
- Uses the mock logger provided by core, instead of using a custom one

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Alejandro Fernández Haro <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 1, 2024
## Summary
Hello, this is a follow up PR to elastic#192234 . The previous PR added
simplistic logging to the saved objects importer. The goal now is to
enhance the logs with information on the saved objects being imported,
how they are imported, and by displaying any errors.

#### `import_saved_objects.ts`:
- Logs specific types being imported
- Logs size limit and overwrite status
- Logs Success/Fail messages

#### Changes to `saved_objects_importer.ts`:
- Passes the logger to `importSavedObjectsFromStream`
- Removes "starting import"

#### Changes to `import_saved_objects.test.ts`:
- Updates it for the new logger parameter

#### Changes to `import.test.ts`:
- Uses the mock logger provided by core, instead of using a custom one

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Alejandro Fernández Haro <[email protected]>
(cherry picked from commit 45543a1)
kibanamachine added a commit that referenced this pull request Nov 1, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [basic enhancements for import logging
(#196056)](#196056)

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

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

<!--BACKPORT [{"author":{"name":"Kyra
Cho","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-01T00:50:21Z","message":"basic
enhancements for import logging (#196056)\n\n## Summary\r\nHello, this
is a follow up PR to #192234 . The previous PR added\r\nsimplistic
logging to the saved objects importer. The goal now is to\r\nenhance the
logs with information on the saved objects being imported,\r\nhow they
are imported, and by displaying any errors.\r\n\r\n####
`import_saved_objects.ts`:\r\n- Logs specific types being imported\r\n-
Logs size limit and overwrite status\r\n- Logs Success/Fail
messages\r\n\r\n#### Changes to `saved_objects_importer.ts`:\r\n- Passes
the logger to `importSavedObjectsFromStream` \r\n- Removes \"starting
import\"\r\n\r\n#### Changes to `import_saved_objects.test.ts`:\r\n-
Updates it for the new logger parameter\r\n\r\n#### Changes to
`import.test.ts`:\r\n- Uses the mock logger provided by core, instead of
using a custom one\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n### For maintainers\r\n\r\n- [ ]
This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
Alejandro Fernández Haro
<[email protected]>","sha":"45543a12a6ce7c32d0a14b45a24eccceca23d9d0","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Saved
Objects","release_note:skip","💝community","v9.0.0","backport:prev-minor","v8.17.0"],"title":"basic
enhancements for import
logging","number":196056,"url":"https://github.com/elastic/kibana/pull/196056","mergeCommit":{"message":"basic
enhancements for import logging (#196056)\n\n## Summary\r\nHello, this
is a follow up PR to #192234 . The previous PR added\r\nsimplistic
logging to the saved objects importer. The goal now is to\r\nenhance the
logs with information on the saved objects being imported,\r\nhow they
are imported, and by displaying any errors.\r\n\r\n####
`import_saved_objects.ts`:\r\n- Logs specific types being imported\r\n-
Logs size limit and overwrite status\r\n- Logs Success/Fail
messages\r\n\r\n#### Changes to `saved_objects_importer.ts`:\r\n- Passes
the logger to `importSavedObjectsFromStream` \r\n- Removes \"starting
import\"\r\n\r\n#### Changes to `import_saved_objects.test.ts`:\r\n-
Updates it for the new logger parameter\r\n\r\n#### Changes to
`import.test.ts`:\r\n- Uses the mock logger provided by core, instead of
using a custom one\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n### For maintainers\r\n\r\n- [ ]
This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
Alejandro Fernández Haro
<[email protected]>","sha":"45543a12a6ce7c32d0a14b45a24eccceca23d9d0"}},"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/196056","number":196056,"mergeCommit":{"message":"basic
enhancements for import logging (#196056)\n\n## Summary\r\nHello, this
is a follow up PR to #192234 . The previous PR added\r\nsimplistic
logging to the saved objects importer. The goal now is to\r\nenhance the
logs with information on the saved objects being imported,\r\nhow they
are imported, and by displaying any errors.\r\n\r\n####
`import_saved_objects.ts`:\r\n- Logs specific types being imported\r\n-
Logs size limit and overwrite status\r\n- Logs Success/Fail
messages\r\n\r\n#### Changes to `saved_objects_importer.ts`:\r\n- Passes
the logger to `importSavedObjectsFromStream` \r\n- Removes \"starting
import\"\r\n\r\n#### Changes to `import_saved_objects.test.ts`:\r\n-
Updates it for the new logger parameter\r\n\r\n#### Changes to
`import.test.ts`:\r\n- Uses the mock logger provided by core, instead of
using a custom one\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n### For maintainers\r\n\r\n- [ ]
This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
Alejandro Fernández Haro
<[email protected]>","sha":"45543a12a6ce7c32d0a14b45a24eccceca23d9d0"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Kyra Cho <[email protected]>
Co-authored-by: Alejandro Fernández Haro <[email protected]>
nreese pushed a commit to nreese/kibana that referenced this pull request Nov 1, 2024
## Summary
Hello, this is a follow up PR to elastic#192234 . The previous PR added
simplistic logging to the saved objects importer. The goal now is to
enhance the logs with information on the saved objects being imported,
how they are imported, and by displaying any errors.

#### `import_saved_objects.ts`:
- Logs specific types being imported
- Logs size limit and overwrite status
- Logs Success/Fail messages

#### Changes to `saved_objects_importer.ts`:
- Passes the logger to `importSavedObjectsFromStream` 
- Removes "starting import"

#### Changes to `import_saved_objects.test.ts`:
- Updates it for the new logger parameter

#### Changes to `import.test.ts`:
- Uses the mock logger provided by core, instead of using a custom one

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Alejandro Fernández Haro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) 💝community release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants