snap_plugin.v1.metric module¶
-
class
snap_plugin.v1.metric.
Metric
(namespace=[], version=None, tags={}, config={}, timestamp=1489110772.705474, unit='', description='', **kwargs)¶ Bases:
object
The metric object is the core entity of snap representing metrics.
- :param namespace (
list
of: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 (
bool
orint
orlong
orfloat
: orbasestring
orbytes
)Returns: value Raises: TypeError
-
description
¶ Metric description
Parameters: value ( str
) –Returns: str
-
namespace
¶ Metric namespace elements.
Returns: list
ofNamespaceElement
)
-
pb
¶
Metric tags.
Parameters: value ( dict
of strings) – {“tag-key”: “tag-value”}Returns: Example: [(“tag-key”, “tag-value”)] Return type: list
oftuple
-
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 (