def collect(self, metrics):
LOG.debug("CollectMetrics called")
for metric in metrics:
switch = {
"float64": random.random(),
"string": "bah",
"int64": random.randint(
metric.config["int_min"],
metric.config["int_max"]
),
"other_value": self._args.some_value,
"*": None
}
typ = metric.namespace[2].value
if typ == "*":
metric.namespace[2].value = str(os.getpid())
if metric.namespace[3].value == "uid":
metric.data = os.getuid()
elif metric.namespace[3].value == "gid":
metric.data = os.getgid()
else:
metric.data = switch[typ]
metric.timestamp = time.time()
return metrics
评论列表
文章目录