Fix: Ensure scrape interval is positive
This commit is contained in:
parent
7c6d32ef7b
commit
20ae18e064
2 changed files with 2 additions and 33 deletions
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
"addr": "127.0.0.1",
|
|
||||||
"port": 8090,
|
|
||||||
"start_delta": "-PT3H",
|
|
||||||
"end_delta": "P60D",
|
|
||||||
"cache": "PT3M",
|
|
||||||
"tz": "Europe/Zurich",
|
|
||||||
"calendars": {
|
|
||||||
"tlstest": {
|
|
||||||
"interval": "PT5M",
|
|
||||||
"url": "https://localhost/private.ics",
|
|
||||||
"ca": "/home/sebastian/tlstest/ca/ca/ca.crt",
|
|
||||||
"auth": {
|
|
||||||
"type": "tls",
|
|
||||||
"keyfile": "/home/sebastian/tlstest/client/combined.pem"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"filetest": {
|
|
||||||
"interval": "PT1M",
|
|
||||||
"url": "file:///srv/http/private.ics"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"key_replace": {
|
|
||||||
"summary": "a_summary",
|
|
||||||
"description": "b_description"
|
|
||||||
},
|
|
||||||
"value_replace": {
|
|
||||||
"summary": "{{ summary|truncate(100, end=' \\N{HORIZONTAL ELLIPSIS}') }}",
|
|
||||||
"description": "{{ description|truncate(100, end=' \\N{HORIZONTAL ELLIPSIS}') }}",
|
|
||||||
"useless_metric": "{{ start.timestamp() + end.timestamp() }}"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -28,7 +28,8 @@ class CalendarConfig:
|
||||||
|
|
||||||
def __init__(self, config: Dict[str, Any], config_path: str) -> None:
|
def __init__(self, config: Dict[str, Any], config_path: str) -> None:
|
||||||
self._url: str = _keycheck('url', config, str, config_path)
|
self._url: str = _keycheck('url', config, str, config_path)
|
||||||
self._scrape_interval: Duration = _parse_timedelta('interval', config, config_path, default_value='PT15M')
|
self._scrape_interval: Duration = _parse_timedelta('interval', config, config_path, default_value='PT15M',
|
||||||
|
force_positive=True)
|
||||||
self._ca: Optional[str] = _keycheck('ca', config, str, config_path, optional=True)
|
self._ca: Optional[str] = _keycheck('ca', config, str, config_path, optional=True)
|
||||||
auth: Dict[str, Any] = _keycheck('auth', config, dict, config_path, default_value={'type': 'none'})
|
auth: Dict[str, Any] = _keycheck('auth', config, dict, config_path, default_value={'type': 'none'})
|
||||||
self._authtype: str = _keycheck('type', auth, str, f'{config_path}.auth',
|
self._authtype: str = _keycheck('type', auth, str, f'{config_path}.auth',
|
||||||
|
|
Loading…
Reference in a new issue