-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Cannot read property 'templateSrv' of undefined #11904
Comments
I can't reproduce this - I tested OpenTSDB on 5.1.2 and in the latest master. The error is from the query controller which is the code for the query editor (the metrics tab). And templateSrv is not used in the OpenTSDB query controller. Can the error be from another panel or datasource? |
Hi @daniellee, Thanks for response. Just noticed that stacktrace is missing crucial part - here is updated version: Panel data error: TypeError: Cannot read property 'templateSrv' of undefined
metrics_panel_ctrl.ts:160
at query_ctrl.ts:5
at lodash.js:2852
at lodash.js:4944
at dr (lodash.js:3001)
at lodash.js:4913
at ur (lodash.js:2851)
at Function.as [as every] (lodash.js:9148)
at query_ctrl.ts:3
at A (lodash.js:823)
at Function.fa [as findIndex] (lodash.js:7275) It actually points to metrics_panel controller, specifically this part I guess: calculateInterval() {
var intervalOverride = this.panel.interval;
// if no panel interval check datasource
if (intervalOverride) {
>> intervalOverride = this.templateSrv.replace(intervalOverride, this.panel.scopedVars);
} else if (this.datasource && this.datasource.interval) {
intervalOverride = this.datasource.interval;
}
var res = kbn.calculateInterval(this.range, this.resolution, intervalOverride);
this.interval = res.interval;
this.intervalMs = res.intervalMs;
}
No. I do have zabbix-grafana plugin installed, but this dashboard is exclusively using OpenTSDB, with datasource version set to version |
Also to add: downgrading to |
Have you got a dashboard (the dashboard json) that does not contain anything sensitive that you can share? I can not recreate this and I don't see any recent changes in the code that could cause this error. The calculateInterval method is internal to the MetricsPanelCtrl and is only triggered when the dashboard is refreshed. If there was an error there then it would affect every datasource not just OpenTSDB. Also, which browser are you using (just to double check that it is not specific to one browser)? |
I've got a very similar problem. I'm using OpenTSDB as backend. I've several of them. OpenTSDB The only difference is the error message I've downgraded to Grafana I confirm there is a real bug with Grafana 5.1 and OpenTSDB 2.0 or 2.1 |
@daniellee here is json from dashboard, with three panels (cpu, memory and swap), where all of three are failing. @degremont I'd add it fails with OpenTSDB 2.2 too. |
@degremont do you have a full stack trace for your error? |
@daniellee I can't copy paste the stacktrace unfortunately. Anyway it is very cumbersome, refering to internal JS files like What I could extract is:
After analysing this minified file which seems related to buffer module from |
FYI, I've updated my OpenTSDB 2.0 cluster to OpenTSDB 2.3. I've forgetted to update the DataSource declaration in Grafana. I was still able to reproduce the problem. After I've properly set the version number, things are fine. So the problem can be simply reproduced changing OpenTSDB version in Grafana DataSource. |
Hi there, I was experiencing the same issue with OpenTSDB 2.2.2 after upgrading from 5.0.4 -> 5.1.3 |
@degremont @sanel does the comment from @bobais help? |
@daniellee it helps to some point. Removing tag However, I'm not using variables in tags at all, just explicitly stating hostname. |
@sanel |
@bobais they are powerful indeed, however, unless grafana completely removes tags support for opentsdb, they aren't working for 5.1 series as described. |
@sanel well works for me in version 5.1.3 also when using variable (mostly using literar_or, wildcard, regexp, with grouping option) on more that 30 different dashboards. I'm affraid I cannot help more. |
@bobais if I'm getting you correct, in your case you have working filters with variables, but not tags? |
@sanel now yes, had similar issue with "Cannot read property 'templateSrv' of undefined" but when I changed old dashboards using tags into format where all filtering is done by filters, all works as expected. That means where I had tag host=myserver I did remove all tags and I did add filter host literar_or myserver (and more when needed). When I wanted to break some data by tag I did choose wildcard * with selection Group by. Anyway I would still consider this as a bug, sice tags are "only" deprecated for OpenTSDB version 2.2 but not removed. Fortunately it doesn't bother me anymore. |
I encountered the same problem with Grafana 5.2.1 in a Docker container, connected to an OpenTSDB database running version 2.2.2. As other folks here already suggested, I could work around the issue by replacing all First of all, if you don't see the A |
Hi,
I started to get above error, after updating Grafana to 5.1.x. Details are below.
What Grafana version are you using?
5.1.2
What datasource are you using?
OpenTSDB
What OS are you running grafana on?
CentOS 7.4
What did you do?
Upgraded Grafana from 5.0.x to 5.1.
What was the expected result?
Dashboards should show metrics, just as in 5.0.x versions.
What happened instead?
Some dashboards started to report: Cannot read property 'templateSrv' of undefined without showing any metrics. Here is stacktrace from js console:
If related to metric query / data viz:
Include raw network request & response: get by opening Chrome Dev Tools (F12, Ctrl+Shift+I on windows, Cmd+Opt+I on Mac), go the network tab.
Here is example from Query Inspector for one of the metrics:
The text was updated successfully, but these errors were encountered: