-
Notifications
You must be signed in to change notification settings - Fork 0
/
timezone-bst.yaml
31 lines (31 loc) · 1.49 KB
/
timezone-bst.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
groups:
- name: utility-timezone-bst
rules:
# Refer: https://github.com/roidelapluie/prometheus-timezone-holidays/blob/master/time.yml
# https://en.wikipedia.org/wiki/British_Summer_Time
# BST begins at 01:00 GMT on the last Sunday of March and ends at 01:00 GMT (02:00 BST) on the last Sunday of October.
# Conditions for summer:
# 1. April to September inclusive
# 2. March, days after last Sunday
# 3. Oct, days till last Sunday
# 4. Oct, till 01:00 GMT & March, from 01:00 GMT
- record: utility:is_summer_time_bst
expr: (vector(1) and (month() > 3 and month() < 10))
or
(vector(1) and (month() == 3 and (day_of_month() - day_of_week()) >= 25) and absent((day_of_month() >= 25) and (day_of_week() == 0)))
or
(vector(1) and (month() == 10 and (day_of_month() - day_of_week()) < 25) and absent((day_of_month() >= 25) and (day_of_week() == 0)))
or
(vector(1) and ((month() == 10 and hour() < 1) or (month() == 3 and hour() > 0)) and ((day_of_month() >= 25) and (day_of_week() == 0)))
or
vector(0)
- record: utility:time_bst
expr: time() + 3600 * utility:is_summer_time_bst
- record: utility:hour_bst
expr: hour(utility:time_bst)
- record: utility:minute_bst
expr: minute(utility:time_bst)
- record: utility:day_of_week_bst
expr: day_of_week(utility:time_bst)
- record: utility:is_weekday_bst
expr: (vector(1) and (utility:day_of_week_bst > 0) and (utility:day_of_week_bst < 6)) or vector(0)