Skip to content
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

[RAM] [Rule Form v2] Add feature flag #179184

Merged
merged 16 commits into from
Mar 27, 2024

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Mar 21, 2024

Summary

Closes #179110

This adds a series of feature flags to all plugins that are currently using the Rule Form Flyout, in preparation for development of the new Create Rule Flow V2 (#175634).

Unfortunately true Kibana feature-flagging is still not yet implemented, so we need to implement this as a config option for every individual affected plugin. The following kibana.yml config will enable the upcoming V2 rule form:

xpack.trigger_actions_ui.enableExperimental: ['ruleFormV2']
xpack.infra.featureFlags.ruleFormV2Enabled: true
xpack.ml.experimental.ruleFormV2.enabled: true
xpack.transform.experimental.ruleFormV2Enabled: true
xpack.legacy_uptime.experimental.ruleFormV2Enabled: true
xpack.observability.unsafe.ruleFormV2.enabled: true
xpack.slo.experimental.ruleFormV2.enabled: true
xpack.apm.featureFlags.ruleFormV2Enabled: true

discover.experimental.ruleFormV2Enabled: true

These feature flags will not enable anything yet. This PR is for the sole purpose of adding these browser-enabled flags now, so that we can reduce the amount of code committed later.

Why feature flag every plugin?

The V1 rule form is currently exported from Triggers Actions UI. In V2, we're moving away from this model and exporting the rule form in a KBN package. Therefore we can't simply export the results of a single feature flag from Triggers Actions UI, we need to signal to each individual plugin whether it should be pulling from the new KBN package or from the old cross-plugin export.

Plugins affected

Triggers Actions UI, Infra, Observability, APM

These plugins already contained interfaces for experimental features or feature flags, so this PR simply adds a new flag to these existing structures.

Discover, ML, Transform, Uptime, SLO

These plugins did not have existing browser-exposed feature flag systems, so this PR adds these interfaces. The transform plugin notably did not yet have any config options configured at all.

Zacqary added 2 commits March 21, 2024 12:32
…flag

# Conflicts:
#	x-pack/plugins/ml/public/application/app.tsx
#	x-pack/plugins/ml/public/application/contexts/ml/serverless_context.tsx
@Zacqary Zacqary added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesManagement Issues related to the Rules Management UX v8.14.0 labels Mar 21, 2024
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@Zacqary Zacqary marked this pull request as ready for review March 21, 2024 17:45
@Zacqary Zacqary requested review from a team as code owners March 21, 2024 17:45
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uptime changes LGTM

@@ -98,6 +100,7 @@ export async function mountManagementSection(

const enabledFeatures: TransformEnabledFeatures = {
showNodeInfo: !isServerless,
ruleFormV2Enabled: experimentalFeatures?.ruleFormV2Enabled ?? false,
};
const unmountAppCallback = renderApp(element, appDependencies, enabledFeatures);
Copy link
Member

@qn895 qn895 Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a super strong opinion on this one but I wonder if it will be more clear to continue passing experimentalFeatures to renderApp(element, appDependencies, enabledFeatures, experimentalFeatures); just like how it's done ML. This way the parameters passed down to are consistent, and also for clarity that it's an experimental feature. Just a thought, not a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, pushing a change

@qn895
Copy link
Member

qn895 commented Mar 21, 2024

Tested ML & Transform changes and LGTM

Copy link
Contributor

@doakalexi doakalexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResponseOps changes LGTM

@davismcphee
Copy link
Contributor

/ci

@@ -354,6 +361,7 @@ export class DiscoverPlugin
customizationContext: {
displayMode: 'standalone',
inlineTopNav: this.inlineTopNav,
ruleFormV2Enabled: this.experimentalFeatures?.ruleFormV2Enabled ?? false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than incorporating this into the customization context, which is used for a different purpose in Discover, I'd prefer we pass ExperimentalFeatures directly into renderApp instead to keep things separated. Then when we need to use it, we can introduce something like a context provider for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, changed this in the latest commit

Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to infra config LGTM.

Copy link
Contributor

@JiaweiWu JiaweiWu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just have a small nitpick, otherwise LGTM

experimentalFeatures: ExperimentalFeatures,
config: ConfigSchema
) {
if (config.experimental?.ruleFormV2?.enabled !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super small nitpick: maybe better to check if its a boolean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to repeat the same pattern used elsewhere in this file

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-only review. Data Discovery changes LGTM

@Zacqary Zacqary requested review from a team as code owners March 22, 2024 21:02
Copy link
Contributor

@jeramysoucy jeramysoucy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kibana security changes LGTM

Copy link
Contributor

@benakansara benakansara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zacqary I think we also need a feature flag for Observability "Create rule" form. wdyt?

@Zacqary
Copy link
Contributor Author

Zacqary commented Mar 25, 2024

@benakansara This same feature flag will apply to both the full page Create Rule form and in-context flyouts.

For creating new rules from the Rules Management page, or editing existing ones, we'll be using this full-page experience: #179105

We'll also be integrating the new UI into flyouts, which we'll be using when the user creates a new rule from the upper-right dropdown from apps like Inventory, Metrics Explorer, etc: #179108

Both of those flows are part of the V2 project, so once they're both implemented, we want to be able to turn them both on or off together.

@benakansara
Copy link
Contributor

@Zacqary thanks for the explanation. To confirm, correct me if I am wrong - The observability Create rule flyout will be replaced with full page experience and to turn full page on / off, the same feature flag will be used. Is it xpack.trigger_actions_ui.enableExperimental: ['ruleFormV2'] feature flag for observability too?

@Zacqary
Copy link
Contributor Author

Zacqary commented Mar 25, 2024

@benakansara I'd love to use just the triggers_actions_ui feature flag to affect every single plugin, but Kibana doesn't allow us to do that right now. True feature flagging is on the Core team's 2024 roadmap, but for now we need to add a flag for every single plugin.

Using this single feature flag would work if we were still sticking with the V1 method of embedding the rule form in solutions: exporting it from triggers_actions_ui and lazy-loading it through functions getAddRuleFlyout. In V2 we're going to be exporting it from @kbn/alerts-ui-shared instead, bypassing triggers_actions_ui entirely.

@botelastic botelastic bot added Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team labels Mar 25, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@Zacqary
Copy link
Contributor Author

Zacqary commented Mar 25, 2024

As per discussion with @benakansara on Slack, added feature flags for observability, apm, and slo

const { appMountParameters } = usePluginContext();

const { appMountParameters, experimentalFeatures } = usePluginContext();
console.log('EXPERIMENTAL', experimentalFeatures);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove console.log?

Copy link
Contributor

@benakansara benakansara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just left a comment about console.log.

@Zacqary Zacqary enabled auto-merge (squash) March 27, 2024 16:53
@Zacqary
Copy link
Contributor Author

Zacqary commented Mar 27, 2024

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.2MB 3.2MB +71.0B
discover 590.2KB 590.3KB +46.0B
ml 3.7MB 3.7MB +169.0B
slo 609.8KB 609.8KB +46.0B
transform 391.7KB 391.9KB +197.0B
uptime 458.8KB 458.8KB +2.0B
total +531.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
discover 34.7KB 34.9KB +214.0B
ml 78.3KB 78.7KB +340.0B
slo 20.8KB 21.2KB +325.0B
transform 18.4KB 18.6KB +193.0B
triggersActionsUi 108.7KB 108.7KB +14.0B
uptime 22.0KB 22.1KB +178.0B
total +1.2KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@Zacqary Zacqary merged commit bfc91b0 into elastic:main Mar 27, 2024
17 of 20 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Alerting/RulesManagement Issues related to the Rules Management UX release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RAM] [Rule Form V2] Add feature flag