[0.9.0] Downsampling and tags
Hi,
I have been playing around with the 0.9.0 version today and I have a question about continuous queries and tags.
Say, I have some data points in measurement X with tag 'foo' and value 'bar' and I have some data points in measurement X with tag 'foo' and value 'baz'. If I downsample using a GROUP BY on time only I loose the tags, right?
The only way to preserve that information AFAIK is to create a continuous query like this:
CREATE CONTINUOUS QUERY x_per_10m ON mydb BEGIN
SELECT count(value) INTO x_10m FROM x GROUP BY time(10m), foo
END
So, every tag I want to preserve needs to be added into the GROUP BY clause.
This makes it difficult to create a downsampling query over multiple measurements that use different tags, because:
- all tags in use by all measurements need to be specified,
- new tags are not automatically added (regenerate the continuous query).
Any thoughts on how to make this easier?
give a try like this; CREATE CONTINUOUS QUERY x_per_10m ON mydb BEGIN SELECT count(value) INTO x_10m FROM x GROUP BY time(10m), * END
Works great, thanks @eminden!
you can add a tag in the origin table,and group by the tag in the continue query shell
@eminden Your solution works great. I was applying downsampling, but it took an aggregate across all tags. If I filtered on, say, hostname = 10.x.x.x, it would return no data, but if I filtered on no tag at all, it worked fine. Thanks for this great solution - always love an easy fix.