Skip to content

Update timezone for cumulative window #2425

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-27 21:31:40.799230",
"spec_repo_commit": "0b2e3d20"
"regenerated": "2025-02-28 17:49:27.289434",
"spec_repo_commit": "59e6a448"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-27 21:31:40.813872",
"spec_repo_commit": "0b2e3d20"
"regenerated": "2025-02-28 17:49:27.303661",
"spec_repo_commit": "59e6a448"
}
}
}
7 changes: 6 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7439,7 +7439,7 @@ components:
properties:
day_starts:
description: The time of the day at which a one day cumulative evaluation
window starts. Must be defined in UTC time in `HH:mm` format.
window starts.
example: 04:00
type: string
hour_starts:
Expand All @@ -7458,6 +7458,11 @@ components:
maximum: 1
minimum: 1
type: integer
timezone:
description: The timezone of the time of the day of the cumulative evaluation
window start.
example: Europe/Paris
type: string
type: object
MonitorOverallStates:
description: The different states your monitor can be in.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,45 @@ def openapi_types(_):
"day_starts": (str,),
"hour_starts": (int,),
"month_starts": (int,),
"timezone": (str,),
}

attribute_map = {
"day_starts": "day_starts",
"hour_starts": "hour_starts",
"month_starts": "month_starts",
"timezone": "timezone",
}

def __init__(
self_,
day_starts: Union[str, UnsetType] = unset,
hour_starts: Union[int, UnsetType] = unset,
month_starts: Union[int, UnsetType] = unset,
timezone: Union[str, UnsetType] = unset,
**kwargs,
):
"""
Configuration options for the evaluation window. If ``hour_starts`` is set, no other fields may be set. Otherwise, ``day_starts`` and ``month_starts`` must be set together.

:param day_starts: The time of the day at which a one day cumulative evaluation window starts. Must be defined in UTC time in ``HH:mm`` format.
:param day_starts: The time of the day at which a one day cumulative evaluation window starts.
:type day_starts: str, optional

:param hour_starts: The minute of the hour at which a one hour cumulative evaluation window starts.
:type hour_starts: int, optional

:param month_starts: The day of the month at which a one month cumulative evaluation window starts.
:type month_starts: int, optional

:param timezone: The timezone of the time of the day of the cumulative evaluation window start.
:type timezone: str, optional
"""
if day_starts is not unset:
kwargs["day_starts"] = day_starts
if hour_starts is not unset:
kwargs["hour_starts"] = hour_starts
if month_starts is not unset:
kwargs["month_starts"] = month_starts
if timezone is not unset:
kwargs["timezone"] = timezone
super().__init__(kwargs)
2 changes: 1 addition & 1 deletion tests/v1/features/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Feature: Monitors
Scenario: Edit a monitor returns "Bad Request" response
Given new "UpdateMonitor" request
And request contains "monitor_id" parameter from "REPLACE.ME"
And body with value {"options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"}
And body with value {"options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"}
When the request is sent
Then the response status is 400 Bad Request

Expand Down