MetricClient
class MetricClient(lightctl.client.base_client.BaseClient)
| Helper functions for acessing metrics
|
| Example:
| mc = MetricClient()
| wc = WorkspaceClient()
| 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:
| print("Workspace {workspace["name"]} Metric {metric["metatdata"]["name"]}
|
| Methods defined here:
|
| create_metric(self, workspace_id: str, data: Dict) -> Dict
| Create a metric
|
| Args:
| workspace_id (str): Workspace id
| data (dict) attributes of metric
|
| Returns:
| dict: the metric created
|
| delete_metric(self, workspace_id: str, id: uuid.UUID, force: bool = False)
| Delete a metric
|
| Args:
| workspace_id (str): Workspace id
| id (UUID): id of metric to delete
| force (bool): if true, delete metric and all dependent monitors. If false, only delete metric if there are no dependent monitors
|
| get_metric(self, workspace_id: str, id: uuid.UUID) -> Dict
| Get a metric by its uuid
|
| Args:
| workspace_id (str): Workspace id
| id (UUID): id of metric to return
|
| Returns:
| dict: a metric
|
| get_metric_by_name(self, workspace_id: str, name: str) -> List[Dict]
| Get a metric by its name
|
| Args:
| workspace_id (str): Workspace id
| name (str): name of metric to return
|
| Returns:
| dict: a metric
|
| list_metrics(self, workspace_id: str) -> List[Dict]
| Get all metrics in the workspace
|
| Args:
| workspace_id (str): Workspace id
|
| Returns:
| list: a list of metrics
|
| metrics_url(self, workspace_id: str) -> str
| Returns:
| str: The metrics endpoint, used for getting and modifying metrics
|
| update_metric(self, workspace_id: str, id: uuid.UUID, data: Dict, force: bool = False) -> Dict
| Update a metric
|
| Args:
| workspace_id (str): Workspace id
| id (UUID): id of metric to update
| data (dict): new attributes of the metric
| force (bool): if true, update metric and delete all dependent monitors. If false, only update metric if there are no dependent monitors
|
| Returns:
| dict: the metric updated
Updated about 1 year ago