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

1 Answers1

0

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

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.

cf. http://kairosdb.github.io/kairosdocs/CassandraSchema.html

May I ask you why do you need to put a JSON object in a tag?

Loic
  • 1,088
  • 7
  • 19