-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Mathematics across measurements #3552
Comments
👍 |
Same here. I'd also like to calculate values across different series like: select * from mysql_value where type='mysql_commands' and type_instance='show_tables' + Cheers, |
same as @hexluthor, I feel this is very limiting: if we need to correlate data coming from various sensors we currently have to write all data as fields in the same measurement... But would it be a good idea in terms of data structure to have a single measurement with more than 50 fields? Will it impact query performance? I'm not comfortable with distorting the data structure (dropping natural data organization) because of technical limitations. |
Also, what are the actual technical issues that prevent InfluxDB to support queries with simple math operations across measurements? |
This was recently changed to a "feature request" so that means it will be evaluated in future releases if we are going to add it or not. There are a couple work arounds right now, and that is to save a calculated field when you write data, such as storing another field for Otherwise, I think these requests are sane, but they will take some work. I believe |
@corylanou about the work around you're talking about: the |
Yes, I believe you should be able to do that in a CQ and then you can select from that retention policy. |
How can we do it in a continuous query? I thought the syntax of normal queries and continuous ones was the same, so if it's possible in one, it should be possible in the other. |
instead of |
And that works across measurements? Using @bbinet's example, this would work?
|
Hmm, it should, but I just tried this basic test and it crashed the server 😢
I logged another issue here: #4183 |
and that was only from one measurement :) |
Hopefully this is a central bug in our post-processing that when fixed will fix all of it. I'll see if I can fix it today. It appears to be just a bad reference while putting the math together, so it might be a quick fix. |
Thanks @corylanou, but as @srfraser said in his previous comment, your example comes from the same measurement: is it supposed to work with multiple measurements? |
Ah, yes, I keep forgetting we don't calculate across values. Although in a simple query we should support this. The biggest problem is type checking and overflow so that when you take an unsigned int and multiple it by a float, etc. that we are able to properly convert to a common type for the math, and not overflow either. |
Ok, I see. |
+1 We REALLY want this for our use-case! |
+1, really missing this feature. |
+1 |
2 similar comments
+1 |
+1 |
👍 |
Opening a feature request kicks off a discussion. Proposal: Implement SQL Joins in the Influx Query Language Use case: When requesting data from InfluxDB it would be very useful to combine metadata, configuration data, etc., from one "table" with the time-series data. For example: assets (measurement) i.e., rundata (measurement) This works great: But this is what I really want: Timestamp Machine Temperature 10/05/2016 8:04:06pm C2475 1675.4 That might be done like this: select |
I dont know if this should be a separate issue, but we would really like to be able to do simple stuff like this:
Note the PortXmitData * 4; this blows up today. The reason for this specific reason is that the metrics from IB equipment are returned as "octets divided by 4” (¼ of the actual number of Bytes)" which Grafana does not know how to deal with (because its a stupid unit). However, there are other cases where doing this sort of simple arithmetic is very useful, and hopefully this is a fairly simple feature to implement. One other feature that is commonly requested is the ability to plot a metric against the mean/95%ile for each item in a GROUP BY. Any method to achieve that is fine by us. |
I understand your issue… makes sense… the same issue in my opinion. I dont know if this should be a separate issue, but we would really like to be able to do simple stuff like this: SELECT non_negative_derivative(last(PortXmitData), $interval) from ibstats WHERE ("interface" =~ /ib./ OR "interface" =~ /p./) AND "host" =~ /$hostname/ and $timeFilter group by time($granularity),interface,host fill(none) Note the tx_bytes * 4; this blows up today. The reason for this specific reason is that the metrics from IB equipment are returned as "octets divided by 4” (¼ of the actual number of Bytes)" which Grafana does not know how to deal with (because its a stupid unit). However, there are other cases where doing this sort of simple arithmetic is very useful, and hopefully this is a fairly simple feature to implement. One other feature that is commonly requested is the ability to plot a metric against the mean/95%ile for each item in a GROUP BY. Any method to achieve that is fine by us. — |
@inselbuch my apologies, I fixed the example query. The problem is that this works: |
+1 Edit: +1ed the OP |
+1 |
I am currently in the process of trying to switch from graphite to influx with grafana as our front end.. I currently have queries like this for graphite but I havent found a way to convert them to influx yet..
Also like this
Any help would be great!!! So I found that I if I am doing math all of the info has to be in the same table. |
+1 we need to do some maths between measurements |
This is a huge feature missing from InfluxDB, making it much less powerful than Prometheus. |
+1 |
2 similar comments
+1 |
+1 |
I think the point has been stated with all of the +1s... This thread should be locked until there is progress on it. |
+1 |
I'm locking this again. While that means you won't be able to add your 👍 reaction, I think there are enough of them that we're well aware people want this feature. We do want to hear any resources that may be useful in terms of implementing this. You can look in the commit log to find my email. If you want to wait for comments regarding this issue, please use the "Subscribe" button on the issue instead of responding to the issue. Thank you. |
Apologies if this is a duplicate, I had a look and couldn't see a relevant issue.
I can see from the documentation how to select from multiple measurements (although it calls them series, still, at https://influxdb.com/docs/v0.9/query_language/data_exploration.html )
For example, with data inserted by telegraf, you can do:
select * from disk_used,disk_total where host = 'myhostname' and path = '/'
How would you express that as a percentage? I've tried variations of the following, and none seem to work:
select disk_used.value/disk_total.value from disk_used, disk_total where host = 'myhostname' and path='/'
The "mydb"."retentionpolicy"."measurement" syntax doesn't work there, either.
Is it a good idea to add aggregation functions for cases like
diff(value1, value2) from m1, m2
anddivide(value, value) from m1, m2
, or should the arithmetic operators be working?Also, I noticed when experimenting that it's also not possible to divide one derivative by another. For example, if I have two counters, bytes transferred and api calls made - both of which are constantly going up - how would you calculate the mean bytes per api call?
The text was updated successfully, but these errors were encountered: