-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Ingest Manager] New structure of agent configuration #19128
Conversation
Pinging @elastic/ingest-management (Team:Ingest Management) |
for _, datasourceNode := range datasourcesList.value { | ||
nsNode, found := datasourceNode.Find("namespace") | ||
for _, inputNode := range inputsNodeList.value { | ||
nsNode, found := inputNode.Find("dataset.namespace") |
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.
Will Find("dataset.namespace")
handle the fact that dataset could be a dictionary in the configuration:
dataset:
namespace: default
name: other
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.
no in fact it will not, i added support for both just to be sure
vars: | ||
var: value | ||
- type: apache/metrics | ||
dataset.namespace: testing |
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.
Probably good to add one of these tests files to use:
dataset:
namespace: testing
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.
do you mean with invalid key?
keys we dont know are passed to input by default
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.
No I mean add a test to ensure that dataset.namespace: testing
or
dataset:
namespace: testing
Both work
addFieldsMap := &Dict{value: []Node{&Key{"add_fields", processorMap}}} | ||
processorsList.value = mergeStrategy(r.OnConflict).InjectItem(processorsList.value, addFieldsMap) | ||
|
||
// add this for backwards compatibility remove later |
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.
Just a general question: When is the remove later?
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.
up to stack when they remove support for this
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.
later is now :-) this was only a short transition where we needed it.
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.
Looks good.
NOTE: do not merge until @ruflin gives a green light |
- namespace: default | ||
inputs: | ||
- type: system/metrics | ||
dataset.namespace: default |
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.
Do you already have support for dataset.type
? I don't think we need it in this PR but curious if you added it?
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.
yep dataset.type is supported
@@ -4,7 +4,6 @@ filebeat: | |||
paths: | |||
- /var/log/hello1.log | |||
- /var/log/hello2.log | |||
dataset: generic |
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.
Shouldn't this become dataset.name
instead of removing it?
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.
yes this became dataset.name thing is we injected it previously which i think is incorrect as we're providing processor to enrich event. if you think this information is helpful in a final beat config i will add it back but for now i filtered it out
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.
Even if the Beat does not understand it today, I think in the future the Beat should so having it there already would be helpful. Can happen in a later PR.
type: testtype | ||
name: generic | ||
namespace: default | ||
- add_fields: |
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.
Not related to this PR but can you follow up to make sure we clean up the stream fields?
id: apache-metrics-id | ||
streams: | ||
- metricset: status | ||
dataset: |
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 assume dataset.name
and
dataset:
name: foo
work?
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 it was a bit tricky as transpiler understands dataset.name
as a single key but i made both versions work
var: value | ||
- type: logs | ||
dataset: | ||
type: testtype |
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.
nice
if !ok { | ||
continue | ||
dsNode, found := inputNode.Find("dataset") | ||
if found { |
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 looks pretty scary! Would be nice if ew can find a way to simplify this.
addFieldsMap := &Dict{value: []Node{&Key{"add_fields", processorMap}}} | ||
processorsList.value = mergeStrategy(r.OnConflict).InjectItem(processorsList.value, addFieldsMap) | ||
|
||
// add this for backwards compatibility remove later |
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.
later is now :-) this was only a short transition where we needed it.
func datasetNamespaceFromInputNode(inputNode Node) string { | ||
const defaultNamespace = "default" | ||
|
||
if namespaceNode, found := inputNode.Find("dataset.namespace"); found { |
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.
Looks like we have very similar code in several places. Two things I'm wondering: Could go-ucfg to this for you and if not, could we extract it into a method?
Tried to test it together with elastic/kibana#69226 but didn't work yet. Not sure if the problem is in KB, Agent or a general issue. Overall changes LGTM. |
tested and setting dataset.type to |
Makes sense as |
Tested with latest kibana changes ok |
* phase 1 * phase 2 * phase 4 * updated configuration * fixed compact form (depends on aprser) * configuration update * fixed tests * mod
* phase 1 * phase 2 * phase 4 * updated configuration * fixed compact form (depends on aprser) * configuration update * fixed tests * mod
What does this PR do?
This PR implements all 4 phases of configuration change described here #19082
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.