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

Add comma templating format #10632

Closed
stefan-improbable opened this issue Jan 26, 2018 · 6 comments
Closed

Add comma templating format #10632

stefan-improbable opened this issue Jan 26, 2018 · 6 comments

Comments

@stefan-improbable
Copy link

Grafana supports multi-selectable template variables for prometheus: http://docs.grafana.org/img/docs/v4/templated_dash.png. They can be used in query like up{server=~"$server"}, however count(up{server="abc"}) by ($groupby_vars) does not work. It is possible to hack around this, but it would be better if grafana supported this natively.

@stefan-improbable stefan-improbable changed the title Grafana GroupBy prometheus template support [Feature Request] Grafana GroupBy prometheus template support Jan 26, 2018
@mtanda
Copy link
Collaborator

mtanda commented Feb 13, 2018

I guess this issue is caused by all template variables are joined by "|".
https://github.com/grafana/grafana/blob/v5.0.0-beta1/public/app/plugins/datasource/prometheus/datasource.ts#L68

In by clause, we need to use "," character.

@stefan-improbable
Copy link
Author

@mtanda yeah, that's correct. If there was an option to use , instead of | (we need both), it would solve my issue.

@torkelo
Copy link
Member

torkelo commented Feb 15, 2018

this will be possible once we add a new interpolation syntax that will allow you to specify formatting when you use the variable:
#9911

example:

count(up{server=~"${server:regex}"}) by (${groupBy:comma})

@mtanda
Copy link
Collaborator

mtanda commented Mar 7, 2018

@torkelo
Copy link
Member

torkelo commented Mar 7, 2018

Now we just need to add a comma format so ${host:comma} not sure what name is best comma or csv

@bergquist bergquist changed the title [Feature Request] Grafana GroupBy prometheus template support Grafana GroupBy prometheus template support Mar 7, 2018
@bergquist bergquist added this to the 5.1 milestone Mar 7, 2018
@bergquist
Copy link
Contributor

Closed by #11141

@bergquist bergquist changed the title Grafana GroupBy prometheus template support Add comma templating format Mar 7, 2018
bergquist added a commit that referenced this issue Mar 7, 2018
bergquist added a commit that referenced this issue Mar 8, 2018
* 'master' of github.com:grafana/grafana: (24 commits)
  docs: update latest to 5.0.1
  push 5.0.1 to package cloud
  changelog: adds release date for 5.0.1
  bump master build to 5.1.0-pre1
  move quota to dedicated service
  rename Context to ReqContext
  changelog: note about closing #11145 and #11127
  docs: adds note about closing #10632
  removes commented code
  removes unused variables
  upgrade to go 1.10
  alerting: fixes validation error when saving alerts in dash
  add csv templating format
  docs: note about closing #11046
  docs: adds note about #10942
  Documentation: path "~/go" to "$GOPATH"
  Update ROADMAP.md
  move Context and session out of middleware
  only use jwt token if it contains an email address
  hide row actions for viewers
  ...
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

5 participants