IncidentClient
class IncidentClient(lightctl.client.base_client.BaseClient)
| Helper functions for acessing incidents
|
| Example:
| mc = MetricClient()
| wc = WorkspaceClient()
| rc = MonitorClient()
| ic = IncidentClient()
| workspace_list = wc.list_workspaces()
| for workspace in workspace_list:
| workspace_id = workspace["uuid"]
| metric_list = mc.list_metrics(workspace_id)
| for metric in metric_list:
| metric_id = metric["metadata"]["uuid"]
| monitor_list = rc.get_monitors_by_metric(workspace_id, metric_id)
| for monitor in monitor_list:
| incidents = ic.get_incidents(workspace_id, monitor["metadata"]["uuid"], start_ts, end_ts)
| num_incidents = 0
| if len(incidents) > 0:
| num_incidents = len(incidents)
| print("Workspace {workspace['name']} Metric {metric['metatdata']['name']} Monitor {monitor['metadata']['name']} {num_incidents} Incidents)
|
| Methods defined here:
|
| incidents_url(self, workspace_id) -> str
| Returns:
| str: The incidents endpoint, used for getting incidents
|
| list_incidents(self, workspace_id: str, start_ts: int, end_ts: int, *, monitor_id: Union[str, NoneType] = None, metric_id: Union[str, NoneType] = None, source_id: Union[str, NoneType] = None, status: Union[str, NoneType] = None) -> Dict
| Args:
| workspace_id (str): Id of workspace
| start_ts (int): start of time range in which to search for incidents
| end_ts (int): end of time range in which to search for incidets
| monitor_id (str): [Optional] Id of monitor associated with the incident
| metric_id (str): [Optional] Id of metric associated with the incident
| source_id (str): [Optional] Id of datasource associated with the incident
| status (str): [Optional] Incident status
|
| Returns:
| list: List of matching incidents in the specified time range
|
| update_incident_status(self, workspace_id: str, id: str, status: str) -> Dict
|
| update_incident_validation(self, workspace_id: str, id: str, status: str) -> Dict
|
Updated about 1 year ago