oncall-engine/engine/apps/metrics_exporter/constants.py
Yulya Artyukhina 15ef692009
OnCall prometheus metrics exporter (#1605)
# What this PR does
Add OnCall prometheus metrics exporter

## Which issue(s) this PR fixes

## Checklist

- [x] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
2023-05-25 18:26:13 +00:00

51 lines
1.3 KiB
Python

import typing
from django.utils import timezone
class AlertGroupsTotalMetricsDict(typing.TypedDict):
integration_name: str
team_name: str
team_id: int
org_id: int
slug: str
id: int
firing: int
acknowledged: int
silenced: int
resolved: int
class AlertGroupsResponseTimeMetricsDict(typing.TypedDict):
integration_name: str
team_name: str
team_id: int
org_id: int
slug: str
id: int
response_time: list
class RecalculateMetricsTimer(typing.TypedDict):
recalculate_timeout: int
forced_started: bool
class RecalculateOrgMetricsDict(typing.TypedDict):
organization_id: int
force: bool
ALERT_GROUPS_TOTAL = "oncall_alert_groups_total"
ALERT_GROUPS_RESPONSE_TIME = "oncall_alert_groups_response_time_seconds"
METRICS_RESPONSE_TIME_CALCULATION_PERIOD = timezone.timedelta(days=7)
METRICS_CACHE_LIFETIME = 93600 # 26 hours. Should be higher than METRICS_RECALCULATE_CACHE_TIMEOUT
METRICS_CACHE_TIMER = "metrics_cache_timer"
METRICS_RECALCULATION_CACHE_TIMEOUT = 86400 # 24 hours. Should be less than METRICS_CACHE_LIFETIME
METRICS_RECALCULATION_CACHE_TIMEOUT_DISPERSE = (0, 3600) # 1 hour
METRICS_ORGANIZATIONS_IDS = "metrics_organizations_ids"
METRICS_ORGANIZATIONS_IDS_CACHE_TIMEOUT = 3600 # 1 hour