Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard support for fields in continuous queries. #5750

Closed
steverweber opened this issue Feb 19, 2016 · 12 comments · Fixed by #7009
Closed

Wildcard support for fields in continuous queries. #5750

steverweber opened this issue Feb 19, 2016 · 12 comments · Fixed by #7009

Comments

@steverweber
Copy link

when the only value was "value", there was a simple way to create a dynamic CQ when backreferencing :measurement however the new format telegraf uses seems to break this.

https://docs.influxdata.com/influxdb/v0.10/query_language/continuous_queries/#cqs-with-backreferencing

I'm wondering if there is a better way to do this so sub measurements are included.

CREATE DATABASE telegraf WITH DURATION 100d
CREATE RETENTION POLICY "7y" ON telegraf DURATION 2555d REPLICATION 1

CREATE CONTINUOUS QUERY "30m_cpu" ON telegraf BEGIN SELECT mean(usage_idle) as usage_idle INTO telegraf."7y".:measurement FROM telegraf."default".cpu GROUP BY time(30m), host END

CREATE CONTINUOUS QUERY "30m_mem" ON telegraf BEGIN SELECT mean(used_percent) as used_percent INTO telegraf."7y".:measurement FROM telegraf."default".mem GROUP BY time(30m), host END

CREATE CONTINUOUS QUERY "30m_disk" ON telegraf BEGIN SELECT mean(used_percent) as used_percent INTO telegraf."7y".:measurement FROM telegraf."default".disk GROUP BY time(30m), host END
@zstyblik
Copy link

As far as I know, there isn't better way and all fields must be listed.

@steverweber
Copy link
Author

Would be nice to have.
Can this request get a milestone?

@adrianlzt
Copy link

+1

@rubycut
Copy link
Contributor

rubycut commented Mar 7, 2016

If I understood correctly, in order to downsample data, I need have create cq query for every single field in every single measurement, that will take like whole week. And every time I add new fields, I will have to add more continuous queries.

I am currently filling up influxdb with new 0.10 version of telegraf, cadvisor and heapster.

And after I do all this, grafana will not recognise this new retention policies unless I change data source.

This is pretty much deal breaker for influxdb,

@nickhuber
Copy link

This seems like a really important feature, since the old style (just a single value) is very simple to downsample but when taking advantage of multiple values per measurements you need to make many continuous queries to get the same result, and could easily miss adding new CQs when new data points are added

@arkadiuszbicz
Copy link

+1

@TomGudman
Copy link

+1

I reckon a blog post on how to set retention policies for many (random) metrics that you do not even know or manage would be good.

For instance in the following examples, you would like influxdb to automagically handle the 'retention rules' of any new metrics :

  • Add a new hosts which will send its metrics to the influx
  • Add a new metric/check on all hosts which will then end in influx

FWIW, our setup: collectd-client --> collectd-server --> influx

@jsternberg
Copy link
Contributor

This will be fixed by #6529 when that's merged.

@klyngbaek
Copy link

+1

@jsternberg
Copy link
Contributor

Wildcard support for only fields is now supported.

@beckettsean
Copy link
Contributor

@jsternberg This seems to be the right issue for field wildcards. I think it was closed by mistake. This functionality definitely does not yet exist.

@beckettsean beckettsean reopened this Jun 2, 2016
@beckettsean
Copy link
Contributor

We do now support SELECT *::field FROM foo but that's only for selecting non-aggregated points. Therefore not useful in CQs, which require a function.

The original ask is to support something like:

SELECT MEAN(*::field) INTO bar FROM foo GROUP BY time(5m) so that CQs can be built without perfect knowledge of the field sets in the measurement. It also makes the CQs future-proof as new fields are added to the measurement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.