[英]save tag in json format in Kairosdb
I'm learning KairosDB with Cassandra backend. 我正在用Cassandra后端学习KairosDB。 And I came across with the following issue:
我遇到了以下问题:
I'm trying to save metrics in the following fashion: 我正在尝试以下列方式保存指标:
available_methods = json.dumps(available_methods)
data = []
for definition in archive_policy.definition:
data.append({'name': '%s-archives' % metric,
'timestamp': time.time(),
'value': archive_policy.back_window,
'tags': {'metric': self._to_hex(metric),
'timespan': float(definition.timespan),
'granularity_points': '%s_%s' % (
float(definition.granularity),
definition.points),
'aggregation_methods': available_methods}})
And as a result, the metric isn't posted with all the importation, there is only name in it. 因此,度量标准不会随所有输入一起发布,其中只有名称。 I tried to post the metric with 'aggregation_methods' equal to string and and worked.
我尝试发布指标,其中'aggregation_methods'等于字符串,并且工作正常。
So, the question is: is it possible to save dict or json format in tags? 所以,问题是:是否可以在标签中保存dict或json格式?
For the record, I'm using pyKairosDB python client. 为了记录,我正在使用pyKairosDB python客户端。
thx 谢谢
actually not all characters are allowed in metric names and tag keys/values. 实际上,在度量标准名称和标记键/值中不允许所有字符。
cf. 比照 http://kairosdb.github.io/kairosdocs/FAQ.html#why-can-tags-only-handle-ascii-characters-and
http://kairosdb.github.io/kairosdocs/FAQ.html#why-can-tags-only-handle-ascii-characters-and
This will evolve in future versions to become more permissive, but some particular character should remain forbidden are the column (:) and equals (=) because they is used as a field separator for constructing Cassandra Row key from tags and metric name. 这将在未来的版本中变得更加宽松,但是一些特定的字符应该保持禁止的是列(:)和等于(=),因为它们被用作字段分隔符,用于从标签和度量标准名称构造Cassandra Row密钥。
cf. 比照 http://kairosdb.github.io/kairosdocs/CassandraSchema.html
http://kairosdb.github.io/kairosdocs/CassandraSchema.html
May I ask you why do you need to put a JSON object in a tag? 我可以问你为什么需要在标签中放置一个JSON对象?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.