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
Support requesting only active tags from influxdb in a time range #7919
Support requesting only active tags from influxdb in a time range #7919
Conversation
var part = query.substr(query.indexOf(';;')); | ||
|
||
arbitraryColumn = part.split(';').length - 2; | ||
console.log(arbitraryColumn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe what this part does? and please remove console log line :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It counts the number of ';', starting from the two consecutive ';;'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and represents it as an index (the -2 part)
I think the use of |
How did the log() get through :D |
efb5c81
to
1db369a
Compare
@torkelo , thank you for the review, pushed an update |
Also there is a way to keep the interface as is and use a regexp. |
Not sure what your trying to solve. Is the problem figuring out which field (column) to use in the InfluxDB response? Can you not write the query so that it only returns a single column? (beside time) |
@torkelo, you can see the precise description of the problem and the workarounds taken (not solved) in heapser issue kubernetes-retired/heapster#1179 In influxdb I can't change the position of the time field, and I cant make it output The problem: |
I understand the bigger problem (query for only active series/tags). But not the need to use number of |
@torkelo, I'm open to any proposal you've got. |
is not always the second column? (or first non time column) ? |
No, it is not, Sure, parsing for select query and (always) taking the second column will work, but is it better than a special query syntax, which imposes no constraints on the user which writes the query? |
yes, by miles compared to using a the number of semi colons at the end of the statement :) |
@torkelo ok, not a problem at all. |
@torkelo, I've pushed a variant w/o semicolumns :D |
All changes done as per given in two Commits. But still getting time column only as per screenshot. |
@nocamin |
this is very close to mergable.
|
@torkelo , when I can get a formal package for this? Thank you. |
@yinhua-dai this is not merged yet as it still needs changes. So hard to say which Grafana release it will be included in. |
@torkelo, thanks for feedback, will update soon. |
@mkutsevol any updates? Would love to see this in grafana. Thanks, |
Switched jobs ~ a couple of month ago, was running out of time completely, moving to a new city, etc. |
25c8267
to
ffb157b
Compare
@torkelo, hi! |
@mkutsevol Thank you! I appreciate you taking the time. Darkmyr |
@Darkmyr, it's my pleasure :D |
I really need this for my AWS environments as well. I'm using immutable deployments for my Elastic Beanstalk and this results in a horde of old instances showing up when I try and filter by host tag. |
Seems like removing one on my email addresses from GH account revoked CLA here, will push again. |
* Added test case * Switched to timeSvr.timeRange()
ffb157b
to
c420bdc
Compare
Would it be possible to do this the same way we do for the Postgres and MySQL data sources with an alias for the field name. Something like: SELECT pod_name as "__text", last(value) FROM uptime WHERE $timeFilter AND namespace_name = '$namespace' GROUP BY pod_name and maybe could support both text and value like this: SELECT pod_name as "__text", pod_template_hash as "__value", last(value) FROM uptime WHERE $timeFilter AND namespace_name = '$namespace' GROUP BY pod_name |
Unfortunately, no. |
Don’t understand. InfluxDB has support for field alias. So why is not possible? |
Ah, ok. I haven't checked influx. You may be right. But I don't have any more will to change this PR. At least in a dramatic way. And I don't see a clear benefit in that approach with aliases. |
@mkutsevol I'm sorry we have been so slow with feedback and that you don't want to work on the PR anymore. We felt that this solution was a bit clunky but we discovered a better way when working on mysql/postgres and I only just now made the connection that this PR is really similar. Is it OK if I take over the PR and finish it then? The benefit with aliases is that:
|
@daniellee, yes, sure, take it over! |
closing this PR as it targets an old branch, and the author has abandoned it. Maybe this PR can solve this, #11846 |
Issues involved
#5327 #1322 #7918
It adds two things to templating.
select
, then it takes the second column from the output (skips the time column)Example usage:
In template query input something like this:
SELECT pod_name,last(value) FROM uptime WHERE $timeFilter AND namespace_name = '$namespace' GROUP BY pod_name
The output from this query is
time, pod_name
lines, and pod_name is being taken.The query output will be limited to only active pod_names in the time range!
Works like a charm for me :D