[Share] Add unused url cleanup task#220138
[Share] Add unused url cleanup task#220138kowalczyk-krzysztof merged 59 commits intoelastic:mainfrom
Conversation
d9149da to
f1c15b1
Compare
0a84aed to
2d8378e
Compare
2d8378e to
7c08f8f
Compare
18ac136 to
7bb7107
Compare
## Summary This PR creates a separate package with `getSpaceIdFromPath` exported to avoid creating a circular dependency in #220138 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…#221596) ## Summary This PR removes spaces plugin dependency from task manager plugin and replaces `spacesService.getActiveSpace` with `getSpaceIdFromPath` from `@kbn/spaces-utils` package. This prevents a circular dependency from happening in #220138 > [!NOTE] > I'm changing the test case to use `test-space` id instead of `testSpace` as this was an invalid space id and it shouldn't have been used in the mock. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
|
dmlemeshko
left a comment
There was a problem hiding this comment.
LGTM, just a small nit
|
Starting backport for target branches: 8.19 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary This PR adds a background task to `share` plugin which periodically deletes saved objects of type `url` which have been older than a value controlled by `share.url_expiration.duration` config - the default is 1 year. The task can be run manually by calling `POST /internal/unused_urls_task/run` with `superuser` privileges. Config options (with their default values): ```yaml share.url_expiration.enabled: false # controls whether the task is enabled share.url_expiration.duration: '1y' # controls the expiration threshold share.url_expiration.check_interval: '7d' # controls how often the task runs share.url_expiration.url_limit: 10000 # controls how many urls should be fetched at once ``` Closes: elastic#179146 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 5c441a4) # Conflicts: # .github/CODEOWNERS # src/platform/plugins/shared/share/kibana.jsonc # src/platform/plugins/shared/share/tsconfig.json
## Summary This PR adds a background task to `share` plugin which periodically deletes saved objects of type `url` which have been older than a value controlled by `share.url_expiration.duration` config - the default is 1 year. The task can be run manually by calling `POST /internal/unused_urls_task/run` with `superuser` privileges. Config options (with their default values): ```yaml share.url_expiration.enabled: false # controls whether the task is enabled share.url_expiration.duration: '1y' # controls the expiration threshold share.url_expiration.check_interval: '7d' # controls how often the task runs share.url_expiration.url_limit: 10000 # controls how many urls should be fetched at once ``` Closes: elastic#179146 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 5c441a4) # Conflicts: # .github/CODEOWNERS # src/platform/plugins/shared/share/kibana.jsonc # src/platform/plugins/shared/share/tsconfig.json
# Backport This will backport the following commits from `main` to `8.19`: - [[Share] Add unused url cleanup task (#220138)](#220138) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Krzysztof Kowalczyk","email":"krzysztof.kowalczyk@elastic.co"},"sourceCommit":{"committedDate":"2025-06-18T14:29:29Z","message":"[Share] Add unused url cleanup task (#220138)\n\n## Summary\nThis PR adds a background task to `share` plugin which periodically\ndeletes saved objects of type `url` which have been older than a value\ncontrolled by `share.url_expiration.duration` config - the default is 1\nyear.\nThe task can be run manually by calling `POST\n/internal/unused_urls_task/run` with `superuser` privileges.\n\nConfig options (with their default values):\n\n```yaml\nshare.url_expiration.enabled: false # controls whether the task is enabled\nshare.url_expiration.duration: '1y' # controls the expiration threshold\nshare.url_expiration.check_interval: '7d' # controls how often the task runs \nshare.url_expiration.url_limit: 10000 # controls how many urls should be fetched at once\n```\n\nCloses: #179146\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"5c441a49cbd12a72a9f32373352dd524c154516d","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:SharedUX","backport:version","v9.1.0","v8.19.0"],"title":"[Share] Add unused url cleanup task","number":220138,"url":"https://github.com/elastic/kibana/pull/220138","mergeCommit":{"message":"[Share] Add unused url cleanup task (#220138)\n\n## Summary\nThis PR adds a background task to `share` plugin which periodically\ndeletes saved objects of type `url` which have been older than a value\ncontrolled by `share.url_expiration.duration` config - the default is 1\nyear.\nThe task can be run manually by calling `POST\n/internal/unused_urls_task/run` with `superuser` privileges.\n\nConfig options (with their default values):\n\n```yaml\nshare.url_expiration.enabled: false # controls whether the task is enabled\nshare.url_expiration.duration: '1y' # controls the expiration threshold\nshare.url_expiration.check_interval: '7d' # controls how often the task runs \nshare.url_expiration.url_limit: 10000 # controls how many urls should be fetched at once\n```\n\nCloses: #179146\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"5c441a49cbd12a72a9f32373352dd524c154516d"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220138","number":220138,"mergeCommit":{"message":"[Share] Add unused url cleanup task (#220138)\n\n## Summary\nThis PR adds a background task to `share` plugin which periodically\ndeletes saved objects of type `url` which have been older than a value\ncontrolled by `share.url_expiration.duration` config - the default is 1\nyear.\nThe task can be run manually by calling `POST\n/internal/unused_urls_task/run` with `superuser` privileges.\n\nConfig options (with their default values):\n\n```yaml\nshare.url_expiration.enabled: false # controls whether the task is enabled\nshare.url_expiration.duration: '1y' # controls the expiration threshold\nshare.url_expiration.check_interval: '7d' # controls how often the task runs \nshare.url_expiration.url_limit: 10000 # controls how many urls should be fetched at once\n```\n\nCloses: #179146\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"5c441a49cbd12a72a9f32373352dd524c154516d"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary This PR adds documentation for unused URLs cleanup task. Implementation PR: #220138 Cloud settings allowlist PR: elastic/cloud#144070
## Summary This PR adds documentation for unused URLs cleanup task. Implementation PR: elastic#220138 Cloud settings allowlist PR: elastic/cloud#144070 (cherry picked from commit 747660d) # Conflicts: # docs/reference/toc.yml
## Summary This PR adds documentation for unused URLs cleanup task. Implementation PR: #220138 Cloud settings allowlist PR: elastic/cloud#144070 --------- Co-authored-by: Florent Le Borgne <florent.leborgne@elastic.co>
## Summary This PR adds documentation for unused URLs cleanup task. Implementation PR: elastic#220138 Cloud settings allowlist PR: elastic/cloud#144070
## Summary This PR adds documentation for unused URLs cleanup task. Implementation PR: elastic#220138 Cloud settings allowlist PR: elastic/cloud#144070
## Summary This PR adds documentation for unused URLs cleanup task. Implementation PR: elastic#220138 Cloud settings allowlist PR: elastic/cloud#144070
Summary
This PR adds a background task to
shareplugin which periodically deletes saved objects of typeurlwhich have been older than a value controlled byshare.url_expiration.durationconfig. This check is based onattributes.accessDateof theurlsaved object.The cleanup can be run manually by calling
POST /internal/unused_urls_task/runwithsuperuserprivileges. This requiresshare.url_expiration.enabledconfig to be set totrue. Thedurationandurl_limitvalues will be based on config.Config options (with their default values):
Closes: #179146
Testing docs (internal)