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

Can't get number as Grafana variable #205

Closed
Severin-S opened this issue Jun 22, 2021 · 2 comments · Fixed by #206
Closed

Can't get number as Grafana variable #205

Severin-S opened this issue Jun 22, 2021 · 2 comments · Fixed by #206
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Severin-S
Copy link

Describe the bug

Trying to set a Grafana variable to the value of a Redis key fails with the following error if the value only contains digits.

Validation
Cannot use 'in' operator to search for 'fields' in NaN

Templating [query0]
Error updating options: Cannot use 'in' operator to search for 'fields' in NaN

Version

Grafana version 7.5.5
Redis plugin version 1.4.0

Steps to reproduce

  1. Execute SET tmp "1" in Redis
  2. Create a new Dashboard in Grafana
  3. Add a variable
  4. Set GET tmp as query

Setting tmp to 1 instead of "1" leads to the same error. When adding any non digit (e.g. "1 ") to the string, the error does not occur.

Expected behavior

The Grafana variable should be set to the value of the Redis key regardless wether it only contains digits or not.

Screenshots

image

@mikhail-vl mikhail-vl self-assigned this Jun 23, 2021
@mikhail-vl mikhail-vl added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jun 23, 2021
@mikhail-vl mikhail-vl added this to the Version 1.5.0 milestone Jun 23, 2021
@mikhail-vl
Copy link
Contributor

@Severin-S thank you for reporting the issue. If the string contains a number, then it's converted to a number for graphs. Unfortunately, I have not tried it for variables recently, using strings in variables for my projects.
I will check how to fix it and get back to you shortly.

@mikhail-vl
Copy link
Contributor

mikhail-vl commented Jun 26, 2021

@Severin-S the issue is fixed for Grafana 7. Grafana 8 returns result differently and works without the fix.
You can test using the latest Docker build: https://redisgrafana.github.io/development/images/
I am planning to release version 1.5.0 with the fix over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants