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

[ML] Daylight saving time calendar events #193605

Merged

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Sep 20, 2024

Adds new pages for creating and managing DST calendars.
Closes #189469

New section added to Settings home page.
image

New page for listing DST calendars. The original calendar page does not show DST calendars.
image

New page for creating DST calendars.
The ability to apply to all jobs and add a description has been removed.
It is not possible manually add events. Events are automatically generated for a selected time zone.
image

If the selected time zone does not observe daylight savings, an info callout is displayed
image

A new DST calendar section is added to all AD job wizards.
image

@jgowdyelastic
Copy link
Member Author

/ci

@jgowdyelastic
Copy link
Member Author

/ci

@jgowdyelastic
Copy link
Member Author

/ci

@jgowdyelastic
Copy link
Member Author

/ci

<p>
<FormattedMessage
id="xpack.ml.settings.anomalyDetection.calendarsDstText"
defaultMessage="Calendars contain a list of scheduled events for which you do not want to generate anomalies, such as planned system outages or public holidays."
Copy link
Member Author

@jgowdyelastic jgowdyelastic Oct 1, 2024

Choose a reason for hiding this comment

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

@szabosteve could you please help with the text for this page.
This text is copied from the normal calendar page, but should instead be about these new DST calendars.

Also the link here goes to our documentation which will need updating.
https://www.elastic.co/guide/en/machine-learning/master/ml-ad-run-jobs.html#ml-ad-calendars

description={
<FormattedMessage
id="xpack.ml.newJob.wizard.jobDetailsStep.additionalSection.calendarsDstSelection.description"
defaultMessage="Something about DST calendars. {learnMoreLink}"
Copy link
Member Author

Choose a reason for hiding this comment

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

@szabosteve can you help me with the text for this section which appears in the AD job wizard?
image

Copy link
Contributor

@szabosteve szabosteve left a comment

Choose a reason for hiding this comment

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

Please see my suggestions for the DST calendar short description below and let me know what you think.

@jgowdyelastic jgowdyelastic marked this pull request as ready for review October 2, 2024 10:23
@jgowdyelastic jgowdyelastic requested a review from a team as a code owner October 2, 2024 10:23
singleSelection={{ asPlainText: true }}
options={timeZoneOptions}
selectedOptions={selectedTimeZones}
onChange={setSelectedTimeZones}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it's better to clear the table of events onChange? Otherwise it can appear that new DST events have been generated without having to press the 'Generate' button as the times in the table change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in db72ef0
The list is replaced when events are generated. I've also removed the generate button completely. Events are now created when a timezone is selected.

Copy link
Contributor

@rbrtj rbrtj left a comment

Choose a reason for hiding this comment

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

Code LGTM, left a few questions and nitpicks

text: i18n.translate('xpack.ml.settings.breadcrumbs.calendarManagementLabel', {
defaultMessage: 'Calendar DST management',
}),
href: '/settings/calendars_dst_list',
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: I see that each breadcrumb is implemented this way, so it's not strictly related to the PR, but why aren't we using locator constants instead of plain strings?

Copy link
Member Author

Choose a reason for hiding this comment

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

we probably should be using those here.
I believe these breadcrumb files pre-date the introduction of the locator constants.

const events = createDstEvents(timezone);

// Each year should have 2 events (start and end of DST)
const expectedNumberOfEvents = 20 * 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Maybe we could reuse YEARS_OF_DST_EVENTS instead of 20?

Copy link
Member Author

Choose a reason for hiding this comment

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

I originally wrote it that way, but then decided that if someone changes YEARS_OF_DST_EVENTS it should be caught in the test as a regression.

Copy link
Contributor

@rbrtj rbrtj Oct 3, 2024

Choose a reason for hiding this comment

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

Nit: With that rewrite to TS, maybe we could also convert the corresponding index.js file, which exports the component, to TS?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, good spot. that file can change

@@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n';
import { EuiPageBody } from '@elastic/eui';

import { getCalendarSettingsData, validateCalendarId } from './utils';
import { CalendarForm } from './calendar_form';
import { CalendarForm } from './calendar_form/calendar_form';
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Why are we directly importing from the file instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is just a vscode autocomplete change. I'll change it back.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 2041 2044 +3

Async chunks

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

id before after diff
ml 4.6MB 4.6MB +10.8KB

Page load bundle

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

id before after diff
ml 74.4KB 74.8KB +483.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
ml 563 567 +4

Total ESLint disabled count

id before after diff
ml 566 570 +4

History

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

cc @jgowdyelastic

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest changes and LGTM

@jgowdyelastic jgowdyelastic merged commit 2881b04 into elastic:main Oct 7, 2024
21 checks passed
@jgowdyelastic jgowdyelastic deleted the daylight-savings-calendar-events branch October 7, 2024 13:35
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11216718699

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 7, 2024
Adds new pages for creating and managing DST calendars.
Closes elastic#189469

New section added to Settings home page.

![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801)

New page for listing DST calendars. The original calendar page does not
show DST calendars.

![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4)

New page for creating DST calendars.
The ability to apply to all jobs and add a description has been removed.
It is not possible manually add events. Events are automatically
generated for a selected time zone.
<img width="1170" alt="image"
src="https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7">

If the selected time zone does not observe daylight savings, an info
callout is displayed
<img width="1178" alt="image"
src="https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387">

A new DST calendar section is added to all AD job wizards.

![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f)

(cherry picked from commit 2881b04)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 7, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Daylight saving time calendar events
(#193605)](#193605)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"James
Gowdy","email":"jgowdy@elastic.co"},"sourceCommit":{"committedDate":"2024-10-07T13:35:25Z","message":"[ML]
Daylight saving time calendar events (#193605)\n\nAdds new pages for
creating and managing DST calendars.\r\nCloses
https://github.com/elastic/kibana/issues/189469\r\n\r\nNew section added
to Settings home
page.\r\n\r\n![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801)\r\n\r\nNew
page for listing DST calendars. The original calendar page does
not\r\nshow DST
calendars.\r\n\r\n![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4)\r\n\r\nNew
page for creating DST calendars.\r\nThe ability to apply to all jobs and
add a description has been removed.\r\nIt is not possible manually add
events. Events are automatically\r\ngenerated for a selected time
zone.\r\n<img width=\"1170\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7\">\r\n\r\nIf
the selected time zone does not observe daylight savings, an
info\r\ncallout is displayed\r\n<img width=\"1178\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387\">\r\n\r\n\r\nA
new DST calendar section is added to all AD job
wizards.\r\n\r\n![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f)","sha":"2881b0423d099649243ee01887f27a1fb6dbffe7","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","Feature:Anomaly
Detection","v9.0.0","release_note:feature","v8.16.0","backport:version"],"title":"[ML]
Daylight saving time calendar
events","number":193605,"url":"https://github.com/elastic/kibana/pull/193605","mergeCommit":{"message":"[ML]
Daylight saving time calendar events (#193605)\n\nAdds new pages for
creating and managing DST calendars.\r\nCloses
https://github.com/elastic/kibana/issues/189469\r\n\r\nNew section added
to Settings home
page.\r\n\r\n![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801)\r\n\r\nNew
page for listing DST calendars. The original calendar page does
not\r\nshow DST
calendars.\r\n\r\n![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4)\r\n\r\nNew
page for creating DST calendars.\r\nThe ability to apply to all jobs and
add a description has been removed.\r\nIt is not possible manually add
events. Events are automatically\r\ngenerated for a selected time
zone.\r\n<img width=\"1170\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7\">\r\n\r\nIf
the selected time zone does not observe daylight savings, an
info\r\ncallout is displayed\r\n<img width=\"1178\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387\">\r\n\r\n\r\nA
new DST calendar section is added to all AD job
wizards.\r\n\r\n![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f)","sha":"2881b0423d099649243ee01887f27a1fb6dbffe7"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193605","number":193605,"mergeCommit":{"message":"[ML]
Daylight saving time calendar events (#193605)\n\nAdds new pages for
creating and managing DST calendars.\r\nCloses
https://github.com/elastic/kibana/issues/189469\r\n\r\nNew section added
to Settings home
page.\r\n\r\n![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801)\r\n\r\nNew
page for listing DST calendars. The original calendar page does
not\r\nshow DST
calendars.\r\n\r\n![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4)\r\n\r\nNew
page for creating DST calendars.\r\nThe ability to apply to all jobs and
add a description has been removed.\r\nIt is not possible manually add
events. Events are automatically\r\ngenerated for a selected time
zone.\r\n<img width=\"1170\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7\">\r\n\r\nIf
the selected time zone does not observe daylight savings, an
info\r\ncallout is displayed\r\n<img width=\"1178\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387\">\r\n\r\n\r\nA
new DST calendar section is added to all AD job
wizards.\r\n\r\n![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f)","sha":"2881b0423d099649243ee01887f27a1fb6dbffe7"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: James Gowdy <jgowdy@elastic.co>
jgowdyelastic added a commit that referenced this pull request Nov 19, 2024
Fixing a typo in the ML locator switch statement which is missing a
`break` for the edit calendar page.
Bug introduced in #193605

Currently there are no instances where the locator is used to find this
page, so this is not something which will affect the user, but it needs
still fixing.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_node:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 19, 2024
Fixing a typo in the ML locator switch statement which is missing a
`break` for the edit calendar page.
Bug introduced in elastic#193605

Currently there are no instances where the locator is used to find this
page, so this is not something which will affect the user, but it needs
still fixing.

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_node:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

(cherry picked from commit 2d970dc)
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
Fixing a typo in the ML locator switch statement which is missing a
`break` for the edit calendar page.
Bug introduced in elastic#193605

Currently there are no instances where the locator is used to find this
page, so this is not something which will affect the user, but it needs
still fixing.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_node:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
Fixing a typo in the ML locator switch statement which is missing a
`break` for the edit calendar page.
Bug introduced in elastic#193605

Currently there are no instances where the locator is used to find this
page, so this is not something which will affect the user, but it needs
still fixing.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_node:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Anomaly Detection ML anomaly detection :ml release_note:feature Makes this part of the condensed release notes v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ML] Configure daylight savings time events for anomaly detection jobs
7 participants