Metric Points¶
Resource¶
Methods¶
-
MetricPoint.
__init__
(manager, data)¶ Resource initializer.
Parameters: - manager – The manager this resource belongs to
- data – The raw json data
-
MetricPoint.
get
(name) → Union[int, str, float, bool]¶ Safely obtain any attribute name for the resource
Parameters: name (str) – Key name in json response Returns: Value from the raw json response. If the key doesn’t exist None
is returned.
-
MetricPoint.
delete
() → None¶ Deletes the resource from the server
-
MetricPoint.
update
()¶ Posts the values in the resource to the server.
Example:
# Change an attribute and save the resource >> resource.value = something >> updated_resource = resource.update()
Returns: The updated resource from the server
Attributes¶
-
MetricPoint.
attrs
¶ The raw json response from the server
Type: dict
-
MetricPoint.
metric_id
¶ Get or set metic id for this metric point
Type: int
-
MetricPoint.
value
¶ Value to plot on the metric graph
Type: float
-
MetricPoint.
created_at
¶ When the metric point was created
Type: datetime
-
MetricPoint.
id
¶ unique id of the metric point
Type: int
-
MetricPoint.
updated_at
¶ Last time the issue was updated
Type: datetime
-
MetricPoint.
calculated_value
¶ The calculated value on metric graph
Type: float
-
MetricPoint.
counter
¶ Show the actual calculated value
Type: int
Manager¶
Methods¶
-
MetricPointsManager.
__init__
(http_client: cachetclient.httpclient.HttpClient)¶ Manager initializer.
Parameters: http_client – The httpclient
-
MetricPointsManager.
create
(*, metric_id: int, value: float) → cachetclient.v1.metric_points.MetricPoint¶ Create an metric point
Keyword Arguments: - metric_id (int) – The metric to tag with the point
- value (fload) – Metric point value for graph
Returns: MetricPoint
instance
-
MetricPointsManager.
list
(metric_id: int, page: int = 1, per_page: int = 20) → Generator[cachetclient.v1.metric_points.MetricPoint, None, None]¶ List updates for a metric
Parameters: metric_id – The metric id to list updates
Keyword Arguments: - page (int) – The first page to request
- per_page (int) – Entries per page
Returns: Generator of
MetricPoint
-
MetricPointsManager.
count
(metric_id) → int¶ Count the number of metric points for a metric
Parameters: metric_id (int) – The metric Returns: Number of metric points for the metric Return type: int
-
MetricPointsManager.
delete
(metric_id: int, point_id: int) → None¶ Delete a metric point
-
MetricPointsManager.
instance_from_dict
(data: dict) → cachetclient.base.Resource¶ Creates a resource instance from a dictionary.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from dictionary data. This can be useful when caching data from cachet in memcache or databases.
Parameters: data (dict) – dictionary containing the instance data Returns: The resource class instance Return type: Resource
-
MetricPointsManager.
instance_from_json
(data: str) → cachetclient.base.Resource¶ Creates a resource instance from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from json data. This can be useful when caching data from cachet in memcache or databases.
Parameters: data (str) – json string containing the instance data Returns: The resource class instance Return type: Resource
-
MetricPointsManager.
instance_list_from_json
(data: str) → List[cachetclient.base.Resource]¶ Creates a resource instance list from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instances from json data. This can be useful when caching data from cachet in memcache or databases.
Parameters: data (str) – json string containing the instance data Returns: The resource class instance Return type: Resource Raises: ValueError
– if json data do not deserialize into a list