kibana
kibana copied to clipboard
[Infra] Add endpoints to manage Custom Dashboards
Closes https://github.com/elastic/kibana/issues/176069
Summary
This adds the logic to register a new Saved Object type to store custom dashboards for Asset Details and adds endpoints to fetch and save custom dashboards.
Changes highlights:
- Renamed the
enableInfrastructureHostsCustomDashboardstoenableInfrastructureAssetCustomDashboardsto make it more generic and support additional asset types in the future - Added a new Saved Object type
- Moved initialization of all Infra endpoints to plugin's
start. This one one of the points on the BE tech debt ticket. Having endpoint initialization instartmakes it more convenient to access start dependencies which almost all endpoints require. - Added
savedObjectClientanduiSettingsClientto the custom request context (also one of the ideas for endpoints improvement). Right now infra endpoints use customlibsobject with all dependencies required for routes, the idea is to rely on the request context instead because it automatically available for every route handler and by default includes some useful things like scoped service clients. - Added a wrapper
handleRouteErrorsto avoid error handling duplication which we now have in a few routes. In the future we could do something similar right withinregisterRoutesframework function, but this would require a bit of refactoring.
Hot to Test
- Toggle the UI setting off in Advanced Settings
- Go to the Dev Tools and try the endpoints, both should respond with 403
GET kbn:api/infra/custom-dashboards/host
POST kbn:api/infra/custom-dashboards
{
"assetType": "host",
"dashboardSavedObjectIdList": ["0", "1"]
}
- Toggle the UI setting on
- Try the endpoints again, now they should work as expected
/ci
:robot: GitHub comments
Expand to view the GitHub comments
Just comment with:
/oblt-deploy: Deploy a Kibana instance using the Observability test environments./oblt-deploy-serverless: Deploy a serverless Kibana instance using the Observability test environments.runelasticsearch-ci/docs: Re-trigger the docs validation. (use unformatted text in the comment!)
/ci
/ci
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)
@elasticmachine merge upstream
@elasticmachine merge upstream
I get bad request for the second query, with both enabled and disabled setting:
Sorry @maryam-saeidi, the field name was updated in the process of code review but I forgot to update the description, the new field name is dashboardIdList instead of dashboardSavedObjectIdList
The description is now up to day.
@elasticmachine merge upstream
:green_heart: Build Succeeded
- Buildkite Build
- Commit: 0dd6e8201220615fb5306c9e1b1b46b61bd34a1d
Metrics [docs]
Public APIs missing comments
Total count of every public API that lacks a comment. Target amount is 0. Run
node scripts/build_api_docs --plugin [yourplugin] --stats commentsfor more detailed information.
| id | before | after | diff |
|---|---|---|---|
infra |
29 | 34 | +5 |
Public APIs missing exports
Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0.
Run node scripts/build_api_docs --plugin [yourplugin] --stats exportsfor more detailed information.
| id | before | after | diff |
|---|---|---|---|
infra |
8 | 6 | -2 |
Saved Objects .kibana field count
Every field in each saved object type adds overhead to Elasticsearch. Kibana needs to keep the total field count below Elasticsearch's default limit of 1000 fields. Only specify field mappings for the fields you wish to search on or query. See https://www.elastic.co/guide/en/kibana/master/saved-objects-service.html#_mappings
| id | before | after | diff |
|---|---|---|---|
infra-custom-dashboards |
- | 4 | +4 |
History
- :yellow_heart: Build #194119 was flaky 1acb44a165e7ce8afc5d8ec3c7ef063b666a3ef1
- :green_heart: Build #193825 succeeded 172881d3ad167f12edc4cad09e905ee140f984f4
- :broken_heart: Build #193760 failed b01e41aa782e4efe8f960d6c067cd2ec50d41399
- :broken_heart: Build #193640 failed ab2de78c8d9d98c8ccf6ba340f2788ef5c8be186
- :broken_heart: Build #193351 failed 881c5b9c66e1e7cd00b1bf6d3431f3134a4c1c57
- :broken_heart: Build #193319 failed 517846ae6485d545a117a8d6afc9c56192b45c7f
To update your PR or re-run it, just comment with:
@elasticmachine merge upstream
💚 All backports created successfully
| Status | Branch | Result |
|---|---|---|
| ✅ | 8.13 |
Note: Successful backport PRs will be merged automatically after passing CI.
Questions ?
Please refer to the Backport tool documentation
