-
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] Enable per policy outputs #126692
[Fleet] Enable per policy outputs #126692
Conversation
Pinging @elastic/fleet (Team:Fleet) |
@@ -25,8 +25,8 @@ export interface NewAgentPolicy { | |||
monitoring_enabled?: MonitoringType; | |||
unenroll_timeout?: number; | |||
is_preconfigured?: boolean; | |||
data_output_id?: string; | |||
monitoring_output_id?: string; | |||
data_output_id?: string | null; |
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.
These fields are nullable to allow to clear them to use the default output
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.
Good note. Would you mind adding that as a comment directly in the code?
|
||
import { useGetOutputs, useLicense } from '../../../../hooks'; | ||
|
||
export const DEFAULT_OUTPUT_VALUE = '@@##DEFAULT_OUTPUT_VALUE##@@'; |
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.
the super select component do not support null or '' as a value so I come with that not super elegant solution
@mostlyjason @dborodyansky In the case we have disabled options (with an expired platinum for example) I am wondering if we can have something similiar to what you designed for the logstash output and policy using APM. (A copy explaining why it's disabled) |
@@ -25,8 +25,8 @@ export interface NewAgentPolicy { | |||
monitoring_enabled?: MonitoringType; | |||
unenroll_timeout?: number; | |||
is_preconfigured?: boolean; | |||
data_output_id?: string; | |||
monitoring_output_id?: string; | |||
data_output_id?: string | null; |
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.
Good note. Would you mind adding that as a comment directly in the code?
const outputsRequest = useGetOutputs(); | ||
const licenseService = useLicense(); | ||
|
||
const isPlatinium = useMemo(() => licenseService.isPlatinium(), [licenseService]); |
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'm curious if our heavy usages of useMemo
is really necessary. I find it makes our UI code much harder to read and I don't think it's necessary unless there's an expensive calculation that we need to avoid. In this case, I think everything we're doing here is pretty fast.
I'd be curious to get the entire @elastic/fleet team's input on 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.
Yes you are right we are probably using too much useMemo for non heavy computation return scalar values
} as any); | ||
} | ||
|
||
describe('validateOutputForPolicy', () => { |
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.
Thank you for these unit tests!
return ( | ||
this.licenseInformation?.isAvailable && | ||
this.licenseInformation?.isActive && | ||
this.licenseInformation?.hasAtLeast('platinum') | ||
); |
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.
nit: this could be simpler probably, but then also maybe we don't need these helper methods for each license type?
return ( | |
this.licenseInformation?.isAvailable && | |
this.licenseInformation?.isActive && | |
this.licenseInformation?.hasAtLeast('platinum') | |
); | |
return this.hasAtLeast('platinum'); |
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 used directly the hasAtLeast
and refactored the existing helper to use hasAtLeast
too
What should the behavior be when an output is removed? When I removed the preconfigured outputs from my kibana.yml, my agent policy that was not using those outputs looked like this and the latest revision doc in In the case of removing preconfigured outputs, I wonder if we should actually log a warning when a preconfigured output is removed that is still in use and then don't delete and make it "unmanaged". We definitely shouldn't allow removing the default output from preconfiguration. For outputs removed from the UI, it seems we already show a warning that this will update X agent policies and affect Y agents (I assume we revert affected policies to the default output) 👍 |
I think something like this could work, I created a new issue, so I can tackle this as a follow up PR and document the decision we take too #126810 |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @nchaulet |
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.
Thanks for filing the follow up, LGTM!
⚪ Backport skippedThe pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
Hi @joshdover We have validated above UI changes and found available on latest builds of 8.2 snapshot.
Build checked at: BUILD: 51365 Further, we have created proposed test cases for same under related ticket (#104987) at doc We will testing the complete scenario when feature will be fully available and will share our observations. Thanks |
Summary
Resolve #104985
Allow user to set per policy outputs (that feature is only accessible for user with platinum licence)
UI Changes
With Platinum licence
With an expired platinum licence and previously configured per policy output
Without platinum licence
How to test
you can use this in your kibana.dev.yml to quickly get some outputs to test
tests
Cover with unit tests: