-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Update types, schemas, and saved objects for datasources. #58921
Update types, schemas, and saved objects for datasources. #58921
Conversation
Based on specs/examples at https://github.com/elastic/beats/blob/feature-ingest/x-pack/agent/docs/agent_configuration_example.yml#L28-L61 & https://github.com/elastic/beats/blob/c46ae67648b08f8d263de3eb7db870f77bbc2558/x-pack/agent/pkg/agent/program/testdata/single_config.yml#L22-L40 Create & list for /datasources API worked as expected Fails type checks because of issues on one UI view (datasources table): ``` ERROR x-pack failed x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/details_page/components/datasources_table.tsx:46:37 - error TS2339: Property 'name' does not exist on type 'DatasourceWithConfig'. 46 originalDatasources?.map(({ id, name, inputs, package: datasourcePackage, configs }) => ({ ~~~~ x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/details_page/components/datasources_table.tsx:51:40 - error TS2339: Property 'title' does not exist on type '{ name: string; version: string; }'. 51 packageTitle: datasourcePackage?.title, ~~~~~ x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/details_page/components/datasources_table.tsx:53:46 - error TS2339: Property 'description' does not exist on type '{ name: string; version: string; }'. 53 packageDescription: datasourcePackage?.description, ~~~~~~~~~~~ Found 3 errors. ```
For the datasource table, the new one changed a lot I think we can use id instead of name see proto |
π Build FailedTest FailuresKibana Pipeline / kibana-oss-agent / Chrome UI Functional Tests.test/functional/apps/context/_date_nanosΒ·js.context app context view for date_nanos displays predessors - anchor - successors in right orderStandard Out
Stack Trace
To update your PR or re-run it, just comment with: |
enabled?: boolean; | ||
dataset?: string; | ||
metricset?: string; | ||
paths?: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: don't we need something like config
(from prior version) that accepts free-typed JSON?
I'm thinking of the use case for Endpoint where we will need to add our policy configuration data.
The example in the beats repo has two suggestions for this use case (line 472 and 578 - I thought that from one of the review meetings, the Endpoint team (@ferullo ) indicated suggestion 2 was best but @ph can confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it seems ok, we will need to update output schema definition as we have changed/added fields there as well. but this should work for datasource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this PR is needed. Our saved object schema does not, and should not, match the agent config spec exactly. The saved object schema needs to 1) provide enough information for UI usage and 2) contain enough fields to translate to agent config. There will be a business layer that translates the saved object to agent config. My work in #58670 referenced the agent config spec, and contains changes to datasources and output types.
I left some comments for explanation. Please let me know if you disagree or see anything that we do need to change that isn't covered by the previous work.
metricset?: string; | ||
paths?: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are examples of fields that don't need to exist in the saved object schema. metricset
and paths
are not applicable to all streams, that's why we have a config
property for arbitrary stream config fields that will then be flattened into the top-level streams object at the business logic layer of converting SO -> agent config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was wondering if this wasn't perhaps an A | B | C
type and if we needed to be that involved in the Agent configs
version: string; | ||
}; | ||
output_id: string; | ||
namespace?: string; | ||
use_output: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example where it's ok that the field name differs in SO than agent schema. The field names will be remapped, but the SO name is more friendly to work with in UI.
@jen-huang π€·ββ I hear what you're saying. As I said, I'm not completely clear here. In the Thursday meeting, @ph mentioned some Fleet changes related to the new Agent config. I offered to help and to sync up with @nchaulet. We met and this is what I understood the changes to be. I don't know if that work is still needed elsewhere or if the changes you mentioned make it unnecessary. Just let me know how I can help. |
Pinging @elastic/ingest (Feature:EPM) |
refs #58874
Based on specs/examples from beats repo 1 & 2
π /datasources POST accepted the various examples linked above and GET returned the list of the datasource objects
β Is this correct? If so, what else do I need to do? Add/update tests? Any esarchiver data/mappings ?
πFails type checks because of issues on one UI view (datasources table):