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

[feature request] backreference for measurement/series when making CQs #2555

Closed
liyichao opened this issue May 13, 2015 · 11 comments
Closed
Assignees
Milestone

Comments

@liyichao
Copy link

I try to create downsampling series:

> create continuous query "1_mins_rollup" on collectd begin select mean(value) into "1_week".:series_name from /^[a-z]+.*/ group by time(1m) end
ERR: error parsing query: found :, expected identifier at line 1, char 92

It seems regex is not supported in influxdb 0.9 now. Then I have to create a continuous query for every measurement or series. It is too tedious.

@beckettsean beckettsean changed the title can not create retention policies for downsampling purpose cannot easily create retention policies for downsampling purpose May 13, 2015
@beckettsean
Copy link
Contributor

The regex is supported but the :series_name backreference is not currently wired up.

@pauldix
Copy link
Member

pauldix commented May 16, 2015

Yeah, we should do this. But it should be :measurement instead.

@pauldix pauldix added this to the 0.9.0 milestone May 16, 2015
@pauldix pauldix modified the milestones: 0.9.1, 0.9.0 Jun 2, 2015
@toddboom toddboom modified the milestones: 0.9.1, 0.9.2 Jun 5, 2015
@srikara
Copy link

srikara commented Jun 26, 2015

+1

@vptheron
Copy link

vptheron commented Jul 6, 2015

@beckettsean when you say "The regex is supported but the :series_name backreference is not currently wired up." what does it mean exactly? That you can query an existing series using a regex or that you can also reference regex groups to dynamically generate the downsampled series (as mentioned in the linked issue #297 ) ?

Is there any way today to dynamically create continuous queries and avoid creating one CQ per existing measurement?

@beckettsean
Copy link
Contributor

@vptheron You can use regex. You cannot use any form of regex backreference like :measurement_name

I am aware of no current way to create CQs dynamically. That's why the backreference is needed.

@beckettsean beckettsean modified the milestones: 0.9.3, 0.9.2 Jul 15, 2015
@beckettsean beckettsean changed the title cannot easily create retention policies for downsampling purpose [feature request] backreference for measurement/series when making CQs Jul 15, 2015
@beckettsean beckettsean modified the milestones: 0.9.4, 0.9.3 Aug 6, 2015
dgnorton added a commit that referenced this issue Aug 27, 2015
Add new query syntax to allow the following in CQs:

INTO "1hPolicy".:MEASUREMENT
dgnorton added a commit that referenced this issue Aug 27, 2015
dgnorton added a commit that referenced this issue Sep 3, 2015
dgnorton added a commit that referenced this issue Sep 3, 2015
dgnorton added a commit that referenced this issue Sep 3, 2015
@torkelo
Copy link

torkelo commented Sep 11, 2015

One thing I am not sure about is how to do a roll up of my 10s data into 1m series, keep all tags for each series (series = measurement and unique tag set).

CREATE CONTINUOUS QUERY myquery ON testdb 
BEGIN 
   SELECT mean(value) INTO "policy1".:measurement FROM /^[a-z]+.*/ GROUP BY time(1m) 
END

So this looks nice, the measurement back reference will allow for a generic rollup rule. But wont the query above (taken from your tests) loose all tag data? Since there are no group by tag it looks like it will be no tags in the target measurement.

And if the group by tag needs to be added to the select or group by clause in order to keep tag data in the target series of the CQ then this feature is incomplete or pointless. At least it does not seem to solve the case of creating generic rollup rules. Or am I missing something for how tags are preserved in the target series of a CQ?

I really would like a way for InfluxDB users to create generic rollup rules, rules that then Grafana can use to pick the right retention policy. Right now InfluxDB users use no rollups and get a horrible and slow experience, would be awesome to solve this :)

ping @pauldix any ideas?

@beckettsean
Copy link
Contributor

Use GROUP BY * to group by all tags without having to reference them
specifically.

Precision thumbed for accuracy

@torkelo
Copy link

torkelo commented Sep 11, 2015

@beckettsean that is great, need to try 0.9.4-rc1 !!

@jeanpralo
Copy link

Hi guys,

@beckettsean, I am currently using 0.9.4.1 was wondering if those sorts of query are suppose to work in that version since I have a panic for this query:

CREATE CONTINUOUS QUERY "5mn_avg"
ON chv2
BEGIN
 SELECT mean(value) as value
 INTO "5mn_avg".:measurement
 FROM /load-load/
 GROUP BY time(5m), host
END

[continuous_querier] 2015/09/22 03:49:03 executing continuous query 5mn_avg
[query] 2015/09/22 03:49:03 SELECT mean(value) AS "value" INTO "chv2"."5mn_avg".:MEASUREMENT FROM "chv2"."default"./load-load/ WHERE time >= '2015-09-22T03:45:00Z' AND time < '2015-09-22T03:50:00Z' GROUP BY time(5m), host
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x624233]

goroutine 64 [running]:
github.com/influxdb/influxdb/cluster.(_PointsWriter).MapShards(0xc82010cd00, 0xc8205bda40, 0x9, 0x0, 0x0)
/tmp/build/src/github.com/influxdb/influxdb/cluster/points_writer.go:179 +0x1f3
github.com/influxdb/influxdb/cluster.(_PointsWriter).WritePoints(0xc82010cd00, 0xc8205bda40, 0x0, 0x0)
/tmp/build/src/github.com/influxdb/influxdb/cluster/points_writer.go:215 +0x1d9
github.com/influxdb/influxdb/services/continuous_querier.(_Service).runContinuousQueryAndWriteResult(0xc820130240, 0xc820352400, 0x0, 0x0)
/tmp/build/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:385 +0x93e
github.com/influxdb/influxdb/services/continuous_querier.(_Service).ExecuteContinuousQuery(0xc820130240, 0xc82066fce8, 0xc8201cfc40, 0xecd92c6af, 0x218089f9, 0xffb6e0, 0x0, 0x0)
/tmp/build/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:292 +0x8a2
github.com/influxdb/influxdb/services/continuous_querier.(_Service).runContinuousQueries(0xc820130240, 0xc82066fe88)
/tmp/build/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:224 +0x3c0
github.com/influxdb/influxdb/services/continuous_querier.(_Service).backgroundLoop(0xc820130240)
/tmp/build/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:203 +0x543
created by github.com/influxdb/influxdb/services/continuous_querier.(*Service).Open
/tmp/build/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:126 +0x2a4

Obviously I would like to avoid to create one CQ per measurement.

@otoolep
Copy link
Contributor

otoolep commented Sep 22, 2015

This looks like the trace fixed by
#4136

This fix would be available in a nightly build, since it went in after
0.9.4.1.

https://influxdb.com/download/index.html

On Mon, Sep 21, 2015 at 9:04 PM, Jean Praloran notifications@github.com
wrote:

Hi guys,

@beckettsean https://github.com/beckettsean, I am currently using
0.9.4.1 was wondering if those sorts of query are suppose to work in that
version since I have a panic for this query:

CREATE CONTINUOUS QUERY "5mn_avg"
ON chv2
BEGIN
SELECT mean(value) as value
INTO "5mn_avg".:measurement
FROM /load-load/
GROUP BY time(5m), host
END

[continuous_querier] 2015/09/22 03:49:03 executing continuous query 5mn_avg
[query] 2015/09/22 03:49:03 SELECT mean(value) AS "value" INTO
"chv2"."5mn_avg".:MEASUREMENT FROM "chv2"."default"./load-load/ WHERE time

= '2015-09-22T03:45:00Z' AND time < '2015-09-22T03:50:00Z' GROUP BY
time(5m), host
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x624233]

goroutine 64 [running]:
github.com/influxdb/influxdb/cluster.(

_PointsWriter).MapShards(0xc82010cd00, 0xc8205bda40, 0x9, 0x0, 0x0)
/tmp/build/src/github.com/influxdb/influxdb/cluster/points_writer.go:179
http://github.com/influxdb/influxdb/cluster/points_writer.go:179 +0x1f3
github.com/influxdb/influxdb/cluster.(
http://github.com/influxdb/influxdb/cluster.(_PointsWriter).WritePoints(0xc82010cd00,
0xc8205bda40, 0x0, 0x0)
/tmp/build/src/github.com/influxdb/influxdb/cluster/points_writer.go:215
+0x1d9
github.com/influxdb/influxdb/services/continuous_querier.(

_Service).runContinuousQueryAndWriteResult(0xc820130240, 0xc820352400,
0x0, 0x0)
/tmp/build/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:385
http://github.com/influxdb/influxdb/services/continuous_querier/service.go:385
+0x93e github.com/influxdb/influxdb/services/continuous_querier.(
http://github.com/influxdb/influxdb/services/continuous_querier.(_Service).ExecuteContinuousQuery(0xc820130240,
0xc82066fce8, 0xc8201cfc40, 0xecd92c6af, 0x218089f9, 0xffb6e0, 0x0, 0x0)
/tmp/build/src/
github.com/influxdb/influxdb/services/continuous_querier/service.go:292
+0x8a2
github.com/influxdb/influxdb/services/continuous_querier.(

Service).runContinuousQueries(0xc820130240, 0xc82066fe88)
/tmp/build/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:224
http://github.com/influxdb/influxdb/services/continuous_querier/service.go:224
+0x3c0 github.com/influxdb/influxdb/services/continuous_querier.(
http://github.com/influxdb/influxdb/services/continuous_querier.(

Service).backgroundLoop(0xc820130240)
/tmp/build/src/
github.com/influxdb/influxdb/services/continuous_querier/service.go:203
+0x543
created by
github.com/influxdb/influxdb/services/continuous_querier.(*Service).Open
/tmp/build/src/
github.com/influxdb/influxdb/services/continuous_querier/service.go:126
+0x2a4

Obviously I would like to avoid to create one CQ per measurement.


Reply to this email directly or view it on GitHub
#2555 (comment).

@jeanpralo
Copy link

@otoolep thanks for that ! it was the problem and it is working on the nightly build !

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

No branches or pull requests

10 participants