-
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
[uiSettings]Removes Infinity from notifications lifetimes #97384
[uiSettings]Removes Infinity from notifications lifetimes #97384
Conversation
@elasticmachine merge upstream |
…emove-notification-lifetime-Infinity-support
91904b3
to
5aa86e3
Compare
Pinging @elastic/kibana-core (Team:Core) |
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), | ||
schema: schema.number({ min: 0 }), |
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 a breaking change for customers, as any Kibana instance currently overriding this value via the uiSettings.overrides
config property will no longer start due to a validation error.
kibana/src/core/server/ui_settings/ui_settings_service.ts
Lines 114 to 122 in f1708dd
private validatesOverrides() { | |
for (const [key, value] of Object.entries(this.overrides)) { | |
const definition = this.uiSettingsDefaults.get(key); | |
// overrides might contain UiSettings for a disabled plugin | |
if (definition?.schema) { | |
definition.schema.validate(value, {}, `ui settings overrides [${key}]`); | |
} | |
} | |
} |
This will also cause warnings every time the uiSettings are fetched:
kibana/src/core/server/ui_settings/ui_settings_client.ts
Lines 174 to 181 in 4584a8b
try { | |
this.validateKey(key, userValue); | |
filteredValues[key] = { | |
userValue: userValue as T, | |
}; | |
} catch (error) { | |
this.log.warn(`Ignore invalid UiSettings value. ${error}.`); | |
} |
If we really want to remove this value from these settings, our only option would be to add the associated migration in src/core/server/ui_settings/saved_objects/migrations.ts
to migrate the value to a new valid one.
However (and I know we already discussed it in the weekly, but), I'm not sure we should drive a model change based only on a UI limitation.
OTOH, note that
- Keep support for 'Infinity' in the code and simply remove the text mentioning it is a valid value from the ui text and the docs since end users have no way of configuring it to anything other than a positive integer. (will also require an update to the docs)
would be awkward for users already using this value, as Infinity
simply does not appear in the UI even if already defined via overrides. However, I think this would be acceptable.
I would pragmatically use this solution for now though, as developing a custom component (and adding the associated uiSettings type) seems to much work for the gain here.
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 would pragmatically use this solution for now though, as developing a custom component (and adding the associated uiSettings type) seems to much work for the gain here
@pgayvallet I agree, and will take the first approach.
overriding this value via the
uiSettings.overrides
config property
I can't find where in the docs we mention these settings, they're not in the Configure Kibana section. Do you know where these are in the docs?
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 sure, we may just not have any documentation on it tbh. Greping uiSettings.overrides
in /docs
has no match... @mshustov maybe you know?
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.
they are not documented in https://www.elastic.co/guide/en/kibana/current/advanced-options.html nor in https://www.elastic.co/guide/en/kibana/current/settings.html
I'd ask Docs team whether we want to announce this API to the wider audience.
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.
we may just not have any documentation on it tbh
Yeah, AFAIK this has always been an undocumented feature since it was added in 6.5. It was in our release notes, but I don't think it was ever added to the documentation.
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.
For now, I'll follow up with a docs PR to remove the sentences mentioning 'Infinity' as an options for the notifications lifetime settings in Advanced Settings.
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.
@elastic/kibana-core it would be nice to have this in for 7.13. If someone has time to have another look, that would be great 😄
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
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.
LGTM
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Resolves #30109
Summary
Follows approach 1 outlined below.
(edit)
Removes support for 'Infinity' and updates text rendered in Advanced Settings for the notifications lifetimesRetains support for 'Infinity' but removes the sentence mentioning using 'Infinity' from the ui text in Advanced settings for:notifications:lifetime:banner
notifications:lifetime:error
notifications:lifetime:warning
notifications:lifetime:info
Updates theschema
for these fields to only allownumber
and updates the description fields, removing the line that mentions using 'Infinity'.If the approach in this PR is approved,A PR to update the docs will follow shortly.History
Several folks have raised issues (e.g. #30109) that there's no way one can set a value of 'Infinity' in Advanced Settings for the notifications banner, error, warning and info lifetimes even though the ui text mentions that 'Infinity' is supported.
I verified the comment that the code itself supports using 'Infinity' and the schema for these fields also allows it.
I traced the problem back through code history and I think the confusion stems from the fact that the descriptions for these fields haven't changed since the settings were first introduced in Feb 2016.
Prior to this PR, setting the value of the notifications' lifetime to 'Infinity' directly in the
notifications
code has the following effect:Note that one can only set the value for
notifications:lifetime:info
toInfinity
if the object is moved further up in the file 🤷♀️ .There are two other approaches we can take here:
Option 1 is less effort than this PR, and we could move the text to a code comment to let developers know it is supported.
Option 2 will require more work as we'd need to redesign the component to allow for both positive numeric fields and an absolute value of 'Infinity'.
Checklist
Delete any items that are not applicable to this PR.
For maintainers