snap_plugin.v1.metric module¶
-
class
snap_plugin.v1.metric.Metric(namespace=[], version=None, tags={}, config={}, timestamp=1489110772.705474, unit='', description='', **kwargs)¶ Bases:
objectThe metric object is the core entity of snap representing metrics.
- :param namespace (
listof:NamespaceElement): - namespace elements
Parameters: - version (
int) – metric version - tags (
dict) – metric tags (key/value pairs) - config (
ConfigMap) – config for metric (key/value pairs) - timestamp (
float) – metric timestamp (see time.time()) - unit (
str) – metric unit - description (
str) – metric description
Example
- metric = Metric(namespace=(“acme”, “sk8”, “matix”, “rotations”),
- description=”Rotation count”)
-
data¶ Metric data
:param value (
boolorintorlongorfloat: orbasestringorbytes)Returns: value Raises: TypeError
-
description¶ Metric description
Parameters: value ( str) –Returns: str
-
namespace¶ Metric namespace elements.
Returns: listofNamespaceElement)
-
pb¶
Metric tags.
Parameters: value ( dictof strings) – {“tag-key”: “tag-value”}Returns: Example: [(“tag-key”, “tag-value”)] Return type: listoftuple
-
timestamp¶ Time in seconds since Epoch.
Parameters: value ( float) – time in seconds since Epoch (see time.time())Returns: time in seconds since Epoch (see time.time()) Return type: float
-
unit¶ Metric unit
Parameters: value ( str) –Returns: str
-
version¶ Metric version.
Parameters: value ( int) – versionReturns: int
- :param namespace (