0

I'm learning KairosDB with Cassandra backend. 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.

So, the question is: is it possible to save dict or json format in tags?

For the record, I'm using pyKairosDB python client.

thx

4

1 に答える 1

0

実際には、すべての文字がメトリック名とタグ キー/値で許可されているわけではありません。

参照。http://kairosdb.github.io/kairosdocs/FAQ.html#why-can-tags-only-handle-ascii-characters-and

これは将来のバージョンでより寛容になるように進化しますが、列 (:) と等号 (=) は、タグとメトリック名から Cassandra 行キーを構築するためのフィールド区切りとして使用されるため、禁止されたままにする必要があります。

参照。http://kairosdb.github.io/kairosdocs/CassandraSchema.html

JSON オブジェクトをタグに入れる必要があるのはなぜですか?

于 2015-03-11T21:38:37.500 に答える