Get "Cannot read property 'templateSrv' of undefined" when adding tags to a query


I use Grafana v5.1.3 (087143285) on my own server (Debian).

Since few releases (I didn’t take time to search for the issue & report it until now), all my metrics queries using tags are not displayed, returning a “Cannot read property ‘templateSrv’ of undefined” error.

Here are some screenshots.

Classical query without tag:
Query with tag :

I can’t find how to fix this issue. Any idea?
If I limit the query to timestamps where there is no data, I don’t have the error. It’s only when datas are returned.

Thank you !

Best regards,

Which datasource is being used?

I use OpenTSDB as source, from OVH.
If I run the command to get the same query from curl, I have the results returned.
I also see them if I check the answer of the query in my browser’s developer tools in network tab.

Is this the builtin opentsdb datasource plugin that comes with Grafana or something else added to your installation?

Looking at the docs from OVH, it appears to be what comes from Grafana:

Yes, it’s the default plugin of Grafana, I’ve not added anything else to default installation.
My configuration is OK (like in the OVH’s docs), it works well if I don’t use tags, but as soon as I use tags, the graph is not created and I get the error.
Again, data points are successfully returned to the request (checked on Chrome developers tools), but graph is not working.

Hi @themen !
I’m happy to see users using Metrics :slight_smile:

I think I know where the issue is, can you tell me what is your read token length ?

Hello Miton18,
The token is a 161 chars string.