Merge "Modifies metername and resource_id"
This commit is contained in:
commit
e17da5ec73
|
@ -32,7 +32,7 @@ class Meter(object):
|
|||
def meter_name(self, vl):
|
||||
"""Return meter name."""
|
||||
# pylint: disable=no-self-use
|
||||
resources = [vl.plugin, vl.type]
|
||||
resources = [vl.type, vl.type_instance]
|
||||
return '.'.join([i for i in resources if i])
|
||||
|
||||
def hostname(self, vl):
|
||||
|
@ -42,7 +42,7 @@ class Meter(object):
|
|||
|
||||
def resource_id(self, vl):
|
||||
"""Get resource ID."""
|
||||
resources = [self.hostname(vl), vl.plugin_instance, vl.type_instance]
|
||||
resources = [self.hostname(vl), vl.plugin, vl.plugin_instance]
|
||||
return '-'.join([i for i in resources if i])
|
||||
|
||||
def unit(self, vl):
|
||||
|
|
|
@ -57,7 +57,9 @@ class Writer(object):
|
|||
# take the plugin (specialized or default) for parsing the data
|
||||
plugin = self._meters.get(vl.plugin)
|
||||
# prepare all data related to the sample
|
||||
metername = plugin.meter_name(vl)
|
||||
metername = "{}@{}".format(
|
||||
plugin.resource_id(vl), plugin.meter_name(vl))
|
||||
|
||||
unit = plugin.unit(vl)
|
||||
timestamp = datetime.datetime.utcfromtimestamp(vl.time).isoformat()
|
||||
|
||||
|
|
Loading…
Reference in New Issue