Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [ECO][Inventory v2] Ad hoc data view: Add get entities definiti…
…on endpoint using sources (#203424) (#203861) # Backport This will backport the following commits from `main` to `8.x`: - [[ECO][Inventory v2] Ad hoc data view: Add get entities definition endpoint using sources (#203424)](#203424) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"jennypavlova","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-11T17:44:57Z","message":"[ECO][Inventory v2] Ad hoc data view: Add get entities definition endpoint using sources (#203424)\n\nCloses #202298 \r\n⚠️ Depends on https://github.com/elastic/kibana/pull/203246\r\n\r\n## Summary\r\n\r\nThis PR changes the way we get the entity index patterns to v2. It\r\ncreates an endpoint part of the inventory API which returns the index\r\npatterns by entity type.\r\n\r\n## Testing\r\n\r\n⚠️ Currently in order to test we need to create the definition using the\r\ndev tools manually before this\r\n[PR](#203246) is merged\r\n\r\n- Open Dev tools and add a definition for an existing entity type\r\n(example with host)\r\n ```\r\nPOST kbn:/internal/entities/v2/definitions/sources\r\n{\r\n \"source\": {\r\n \"id\": \"host_id\",\r\n \"type_id\": \"host\",\r\n \"index_patterns\": [\"metrics-*\", \"metricbeat-*\"],\r\n \"identity_fields\": [\"host.name\"],\r\n \"metadata_fields\": [],\r\n \"filters\": [],\r\n \"timestamp_field\": \"@timestamp\"\r\n }\r\n ```\r\n\r\n### Test the endpoint: \r\n- Open Dev tools and add\r\n` GET kbn:/internal/inventory/entity/definitions/sources?type=host `\r\n- Response: \r\n<img width=\"408\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1c7416b0-50a4-4e63-8081-928ec7856ff8\">\r\n\r\n### Test in the UI\r\n- After the previous steps add some host data (oblt cluster /\r\nmetricbeat) or use synthtrace (for example use `node scripts/synthtrace\r\ninfra_hosts_with_apm_hosts --scenarioOpts.numInstances=10`)\r\n- Go to Inventory and expand the host group\r\n- Click on the actions button for any host and click on the Discover\r\nlink\r\n- The correct dataview should be selected based on the created\r\ndefinition\r\nThe same can be done for other entity types\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c9c3a7ae-daff-4d4b-b1b7-898c3f1603c6\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo <[email protected]>","sha":"5bacf1fe50ae373f5951d227ef487a6714aeb541","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"[ECO][Inventory v2] Ad hoc data view: Add get entities definition endpoint using sources","number":203424,"url":"https://github.com/elastic/kibana/pull/203424","mergeCommit":{"message":"[ECO][Inventory v2] Ad hoc data view: Add get entities definition endpoint using sources (#203424)\n\nCloses #202298 \r\n⚠️ Depends on https://github.com/elastic/kibana/pull/203246\r\n\r\n## Summary\r\n\r\nThis PR changes the way we get the entity index patterns to v2. It\r\ncreates an endpoint part of the inventory API which returns the index\r\npatterns by entity type.\r\n\r\n## Testing\r\n\r\n⚠️ Currently in order to test we need to create the definition using the\r\ndev tools manually before this\r\n[PR](#203246) is merged\r\n\r\n- Open Dev tools and add a definition for an existing entity type\r\n(example with host)\r\n ```\r\nPOST kbn:/internal/entities/v2/definitions/sources\r\n{\r\n \"source\": {\r\n \"id\": \"host_id\",\r\n \"type_id\": \"host\",\r\n \"index_patterns\": [\"metrics-*\", \"metricbeat-*\"],\r\n \"identity_fields\": [\"host.name\"],\r\n \"metadata_fields\": [],\r\n \"filters\": [],\r\n \"timestamp_field\": \"@timestamp\"\r\n }\r\n ```\r\n\r\n### Test the endpoint: \r\n- Open Dev tools and add\r\n` GET kbn:/internal/inventory/entity/definitions/sources?type=host `\r\n- Response: \r\n<img width=\"408\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1c7416b0-50a4-4e63-8081-928ec7856ff8\">\r\n\r\n### Test in the UI\r\n- After the previous steps add some host data (oblt cluster /\r\nmetricbeat) or use synthtrace (for example use `node scripts/synthtrace\r\ninfra_hosts_with_apm_hosts --scenarioOpts.numInstances=10`)\r\n- Go to Inventory and expand the host group\r\n- Click on the actions button for any host and click on the Discover\r\nlink\r\n- The correct dataview should be selected based on the created\r\ndefinition\r\nThe same can be done for other entity types\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c9c3a7ae-daff-4d4b-b1b7-898c3f1603c6\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo <[email protected]>","sha":"5bacf1fe50ae373f5951d227ef487a6714aeb541"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203424","number":203424,"mergeCommit":{"message":"[ECO][Inventory v2] Ad hoc data view: Add get entities definition endpoint using sources (#203424)\n\nCloses #202298 \r\n⚠️ Depends on https://github.com/elastic/kibana/pull/203246\r\n\r\n## Summary\r\n\r\nThis PR changes the way we get the entity index patterns to v2. It\r\ncreates an endpoint part of the inventory API which returns the index\r\npatterns by entity type.\r\n\r\n## Testing\r\n\r\n⚠️ Currently in order to test we need to create the definition using the\r\ndev tools manually before this\r\n[PR](#203246) is merged\r\n\r\n- Open Dev tools and add a definition for an existing entity type\r\n(example with host)\r\n ```\r\nPOST kbn:/internal/entities/v2/definitions/sources\r\n{\r\n \"source\": {\r\n \"id\": \"host_id\",\r\n \"type_id\": \"host\",\r\n \"index_patterns\": [\"metrics-*\", \"metricbeat-*\"],\r\n \"identity_fields\": [\"host.name\"],\r\n \"metadata_fields\": [],\r\n \"filters\": [],\r\n \"timestamp_field\": \"@timestamp\"\r\n }\r\n ```\r\n\r\n### Test the endpoint: \r\n- Open Dev tools and add\r\n` GET kbn:/internal/inventory/entity/definitions/sources?type=host `\r\n- Response: \r\n<img width=\"408\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1c7416b0-50a4-4e63-8081-928ec7856ff8\">\r\n\r\n### Test in the UI\r\n- After the previous steps add some host data (oblt cluster /\r\nmetricbeat) or use synthtrace (for example use `node scripts/synthtrace\r\ninfra_hosts_with_apm_hosts --scenarioOpts.numInstances=10`)\r\n- Go to Inventory and expand the host group\r\n- Click on the actions button for any host and click on the Discover\r\nlink\r\n- The correct dataview should be selected based on the created\r\ndefinition\r\nThe same can be done for other entity types\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c9c3a7ae-daff-4d4b-b1b7-898c3f1603c6\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo <[email protected]>","sha":"5bacf1fe50ae373f5951d227ef487a6714aeb541"}}]}] BACKPORT--> Co-authored-by: jennypavlova <[email protected]>
- Loading branch information