{"action":"created","issue":{"url":"https://api.github.com/repos/grafana/grafana/issues/10000","repository_url":"https://api.github.com/repos/grafana/grafana","labels_url":"https://api.github.com/repos/grafana/grafana/issues/10000/labels{/name}","comments_url":"https://api.github.com/repos/grafana/grafana/issues/10000/comments","events_url":"https://api.github.com/repos/grafana/grafana/issues/10000/events","html_url":"https://github.com/grafana/grafana/issues/10000","id":277029037,"number":10000,"title":"A template variable value breaks some panels of the dashboard","user":{"login":"BenjaminDebeerst","id":2771038,"avatar_url":"https://avatars3.githubusercontent.com/u/2771038?v=4","gravatar_id":"","url":"https://api.github.com/users/BenjaminDebeerst","html_url":"https://github.com/BenjaminDebeerst","followers_url":"https://api.github.com/users/BenjaminDebeerst/followers","following_url":"https://api.github.com/users/BenjaminDebeerst/following{/other_user}","gists_url":"https://api.github.com/users/BenjaminDebeerst/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjaminDebeerst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjaminDebeerst/subscriptions","organizations_url":"https://api.github.com/users/BenjaminDebeerst/orgs","repos_url":"https://api.github.com/users/BenjaminDebeerst/repos","events_url":"https://api.github.com/users/BenjaminDebeerst/events{/privacy}","received_events_url":"https://api.github.com/users/BenjaminDebeerst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-11-27T14:04:00Z","updated_at":"2017-11-27T15:18:59Z","closed_at":null,"author_association":"NONE","body":"I have a Grafana dashboard set up with a couple of template variables. For some values this dashboard works just fine, for others with no noticeable difference (length, special characters) all the panels on the dashboard break. The query editor for the panels show `{{ctrl.target.refId}} ({{ctrl.target.datasource}})` instead of the query and the JS console shows `Panel data error: TypeError: a is undefined`.\r\n\r\nOn other dashboards the same issue affects just some of the panels, but so far I have been unable to understand the difference between the panels that makes the one to break and the other not to break.\r\n\r\nThe answers to the issue template questions:\r\n- What Grafana version are you using? 4.5.1\r\n- What datasource are you using? Prometheus\r\n- What OS are you running grafana on? Linux, 4.4 Kernel\r\n- What did you do? Select another value for a template variable\r\n- What was the expected result? The panels should change the data shown, matching the template variable selection\r\n- What happened instead? All panels show the red exclamation mark in the corner and the queries vanish from the 'edit query' dialogue, being replaced by `{{ctrl.target.refId}} ({{ctrl.target.datasource}})`\r\n\r\nHere's the Stacktrace from the JS Console\r\n```\r\nPanel data error: \r\nTypeError: a is undefined\r\nStack trace:\r\nc@http://grafana.company.org/public/app/plugins/datasource/prometheus/datasource.js?bust=1511790240190:4:170\r\nl@http://grafana.company.org/public/app/boot.26e86561.js:75:1446\r\nSg@http://grafana.company.org/public/app/boot.26e86561.js:76:2113\r\nexecute/k</a.prototype.interpolateQueryExpr@http://grafana.company.org/public/app/plugins/datasource/prometheus/datasource.js?bust=1511790240190:4:1201\r\nthis.formatValue@http://grafana.company.org/public/app/boot.26e86561.js:10:22221\r\nthis.replace/<@http://grafana.company.org/public/app/boot.26e86561.js:10:23603\r\nthis.replace@http://grafana.company.org/public/app/boot.26e86561.js:10:23326\r\nexecute/k</a.prototype.query@http://grafana.company.org/public/app/plugins/datasource/prometheus/datasource.js?bust=1511790240190:4:1593\r\nexecute/k</b.prototype.issueQueries@http://grafana.company.org/public/app/boot.26e86561.js:74:13256\r\nexecute/i</b.prototype.issueQueries@http://grafana.company.org/public/app/boot.26e86561.js:20:8395\r\ni@http://grafana.company.org/public/app/boot.26e86561.js:61:24011\r\nl/<@http://grafana.company.org/public/app/boot.26e86561.js:61:24433\r\n$eval@http://grafana.company.org/public/app/boot.26e86561.js:61:31584\r\n$digest@http://grafana.company.org/public/app/boot.26e86561.js:61:30053\r\n$apply@http://grafana.company.org/public/app/boot.26e86561.js:61:31869\r\nx/i<@http://grafana.company.org/public/app/boot.26e86561.js:61:27919\r\nf@http://grafana.company.org/public/app/boot.26e86561.js:60:10161\r\npb/k.defer/c<@http://grafana.company.org/public/app/boot.26e86561.js:60:11624\r\n```\r\n \r\n"},"comment":{"url":"https://api.github.com/repos/grafana/grafana/issues/comments/347213853","html_url":"https://github.com/grafana/grafana/issues/10000#issuecomment-347213853","issue_url":"https://api.github.com/repos/grafana/grafana/issues/10000","id":347213853,"user":{"login":"BenjaminDebeerst","id":2771038,"avatar_url":"https://avatars3.githubusercontent.com/u/2771038?v=4","gravatar_id":"","url":"https://api.github.com/users/BenjaminDebeerst","html_url":"https://github.com/BenjaminDebeerst","followers_url":"https://api.github.com/users/BenjaminDebeerst/followers","following_url":"https://api.github.com/users/BenjaminDebeerst/following{/other_user}","gists_url":"https://api.github.com/users/BenjaminDebeerst/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjaminDebeerst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjaminDebeerst/subscriptions","organizations_url":"https://api.github.com/users/BenjaminDebeerst/orgs","repos_url":"https://api.github.com/users/BenjaminDebeerst/repos","events_url":"https://api.github.com/users/BenjaminDebeerst/events{/privacy}","received_events_url":"https://api.github.com/users/BenjaminDebeerst/received_events","type":"User","site_admin":false},"created_at":"2017-11-27T15:18:59Z","updated_at":"2017-11-27T15:18:59Z","author_association":"NONE","body":"Hi @mtanda,\r\nthanks for looking into it so quickly. You first comment did already point me in the right direction. I probably need to fix the template query because for some values of template variable 1, there are no values to be found with the query for variable 2.\r\nThe template variables use queries that depend on each other, so this is a user issue: the prometheus targets just don't export sufficiently uniform labels.\r\n\r\nI checked the JSON as you suggested and in both the failure and non failure case, the label value part of the Json looks the same: The options array is empty.\r\n\r\nHowever the template value drop down offered an empty string option. Excluding this from the label selection made it disappear and fixed the dashboard.\r\nSo in the template query I changed\r\n`label_values({__name__=\"my_metric\",label1=~\"$label1\",label2!=\"\"}, label2)` to `label_values({__name__=\"my_metric\",label1=~\"$label1\"}, label2)`\r\nThis fixed it.\r\n\r\nHowever, I would expect Grafana to fail more gracefully.\r\n\r\nThanks again for the quick follow-up."}}
{"actor":{"display_login":"BenjaminDebeerst"}}