-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Support Elasticsearch output performance presets #172359
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
...ns/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx
Outdated
Show resolved
Hide resolved
...ns/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx
Outdated
Show resolved
Hide resolved
Yes we should show the callout. One thing to note is that we're only doing a rudimentary string match on reserved keys, not parsing the YAML and checking the resulting key contents. So there will be some non-obvious behavior for now, e.g. # Successfully forces `custom` preset, display callout
queue.mem.events: 1000
# Doesn't force the preset or show the callout, but would still be ignored by agent
queue:
mem:
events: 1000 I think this is an okay corner to cut for now, but if we have time it would be good to get a more sophisticated parsing pattern in place where we
This might not be too hard with some combination of the |
@cmacknz I have added actual YML parsing to the validation here + unit tests. Hence, this will now close #172525. |
export function outputYmlIncludesReservedPerformanceKey(configYml: string) { | ||
if (!configYml || configYml === '') { | ||
return false; | ||
} | ||
|
||
const parsedYml = yaml.safeLoad(configYml); | ||
|
||
if (!isObject(parsedYml)) { | ||
return RESERVED_CONFIG_YML_KEYS.some((key) => parsedYml.includes(key)); | ||
} | ||
|
||
const flattenedYml = isObject(parsedYml) ? getFlattenedObject(parsedYml) : {}; | ||
|
||
return RESERVED_CONFIG_YML_KEYS.some((key) => Object.keys(flattenedYml).includes(key)); | ||
} |
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 function now parses YML if possible when checking for reserved keys
describe('outputYmlIncludesReservedPerformanceKey', () => { | ||
describe('dot notation', () => { | ||
it('returns true when reserved key is present', () => { | ||
const configYml = `queue.mem.events: 1000`; | ||
|
||
expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(true); | ||
}); | ||
|
||
it('returns false when no reserved key is present', () => { | ||
const configYml = `some.random.key: 1000`; | ||
|
||
expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('object notation', () => { | ||
it('returns true when reserved key is present', () => { | ||
const configYml = ` | ||
queue: | ||
mem: | ||
events: 1000 | ||
`; | ||
|
||
expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(true); | ||
}); | ||
|
||
it('returns false when no reserved key is present', () => { | ||
const configYml = ` | ||
some: | ||
random: | ||
key: 1000 | ||
`; | ||
|
||
expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('plain string', () => { | ||
it('returns false when no reserved key is present', () => { | ||
const configYml = `bulk_max_size`; | ||
|
||
expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(true); | ||
}); | ||
|
||
it('returns true when reserved key is present', () => { | ||
const configYml = `just a string`; | ||
|
||
expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(false); | ||
}); | ||
}); | ||
}); |
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.
Relevant YML parsing test cases here - we also still check plain strings even if the YML is invalid just to be sure.
@elasticmachine merge upstream |
Bundle size blew up because of the |
@elasticmachine merge upstream |
|
Hmm maybe my interpretation of the webpack analyzer is wrong or I'm missing something. We import |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @kpollich |
Summary
Closes #166870
Closes #172525
preset
field to output saved objectspreset
field inPOST/PUT
requests to the/api/fleet/outputs
endpointpreset
tobalanced
orcustom
based on whether a reserved key exists inoutput.config_yaml
setup
that updates all existing outputs + redeploys their associated policies to ensure the properpreset
is provided on all policiesTo do
EuiSelect
when output is managedcustom
preset (Follow up: [Fleet] Make custom performance preset logic more robust when checking for reserved fields in custom YAML box #172525)How to test
Performance preset
dropdown defaults tobalanced
bulk_max_size: 1000
Custom
and is now disabledFor the backfill
main
preset
valueScreenshots + Screen recordings
Screen.Recording.2023-12-01.at.8.35.59.AM.mov