snap_plugin.v1.namespace module¶
-
class
snap_plugin.v1.namespace.Namespace(pb, *elements)¶ Bases:
objectNamespace of a metric.
- :param elements (
listof:NamespaceElement - or
listofstrings): namespace elements
-
add(namespace_element)¶
-
add_dynamic_element(name, description)¶ Adds a dynamic namespace element to the end of the Namespace.
A dynamic namespace element is defined by an element that contains a non-static data relative to the metric being collected. For instance, when collecting metrics for a given virtual machine the namespace element that contains the virtual-machine-id would be dynamic. This is modeled by the a NamespaceElement when its
nameattribute contains the value ‘virtual-machine-id’. In this example thevalueattribute would be set to the ID of the virtual machine when the metric is collected.Parameters: value ( snap_plugin.v1.namespace_element.NamespaceElement) – namespace elementReturns: snap_plugin.v1.namespace.Namespace
-
add_static_element(value)¶ Adds a static namespace element to the end of the Namespace.
A static namespace element is defined by the
valueattribute being set and where thenameattribute is not used (set to None). This is the case when the namespace does not change based on what is being collected.Parameters: value ( snap_plugin.v1.namespace_element.NamespaceElement) – namespace elementReturns: snap_plugin.v1.namespace.Namespace
-
pop(key=-1)¶ Removes and retuns the namespace element at a given index.
If the kwarg ‘key’ is provided the item at the given index is removed and returned. If the kwarg ‘key’’ is not provided the last Namespace element is removed and returned.
Parameters: **kwargs (optional) – key=-1
- :param elements (