Comments (9)
Hi @MathieuEtchepare
The trick with LUA script should work fine on a single shard deployment.
Another option is to utilize RedisGears module. RedisGears is a powerful framework for the execution of the functions. It supports Python and C API.
Here is an example of the script
gb = GB('CommandReader')
gb.flatmap(lambda x: execute('SUNION',*x[1].split(",")))
gb.register(trigger='SUNION')
Which you can load to the database with RedisGears enabled like:
redis-cli -p 6379 RG.PYEXECUTE "$(cat sunion.py)"
To execute the trigger:
redis-cli -p 6379 RG.TRIGGER SUNION 'America,Europe'
1) "Spain"
2) "UK"
3) "France"
4) "USA"
5) "Mexico"
Use RG.TRIGGER SUNION ${<your-multi-select-variable>:csv}
to display in Grafana.
Thank you
__
Nail
from grafana-redis-datasource.
Hello @MathieuEtchepare, thank you for opening the issue.
When you have multi-value variables, you should use repeat panels or rows for this variable. This feature was introduced for backend plugins in Grafana 7.1 and the latest version of Redis Data Source 1.2, please make sure that you are using the latest version.
Can you use first variable in the query or command directly instead of using 2nd variable?
You may take a look at the example dashboard, which has multi-value for Redis instances: https://github.com/RedisTimeSeries/grafana-redis-datasource/blob/master/dashboards/redis.json
Let me know if it's clear.
from grafana-redis-datasource.
Thanks for your answer.
I just noticed that the last part of my question was really unclear and I'm sorry for that.
As a matter of fact, I'm using a first variable to display geographical zones, let's say America, Europe and Asia.
For each I have a list in redis named after it with countries.
To sum up in redis I have:
- Regions [America, Europe, Asia]
- America [USA, Mexico, ...]
- Asia [China, Japan, ...]
- Europe [France, UK, Spain, ...]
If I select in the first variable America and Europe, is there a way to display the union of these two zones in a second variable?
(By the way, the dashboard, you linked is awesome, I'm going to use it a lot thank you)
from grafana-redis-datasource.
Hello @MathieuEtchepare,
There are multiple advanced variable format options for variables in Grafana which you can play with: https://grafana.com/docs/grafana/latest/variables/advanced-variable-format-options/
Do you keep countries as LIST data type or SET?
from grafana-redis-datasource.
I'm keeping them as a set, I looked at the SUNION command but it needs spaced separated values I think, which is not possible with Grafana if I read correctly the doc you just sent.
from grafana-redis-datasource.
@MathieuEtchepare, one of the possible solutions is to use EVAL command:
eval "return redis.call('sunion',${region:singlequote})" 0
I am checking with the team for other options.
from grafana-redis-datasource.
Hello @MathieuEtchepare, please let us know if LUA or RedisGears solution works for you.
from grafana-redis-datasource.
Hi,
Sorry for the late response, I was on other subjects these days...
I am going to use the LUA solution as I only need a simple line of code for now, but I will think about RedisGears if I need a more complex solution.
Thanks for your time, I really appreciate the effort you put into helping me.
Have a nice day! 😃
from grafana-redis-datasource.
@MathieuEtchepare, thank you for the update.
Please let us know if you need anything else.
from grafana-redis-datasource.
Related Issues (20)
- Simple way to query all streams and retrieve length of stream HOT 2
- Add support for FT.SEARCH and FT.AGGREGATE HOT 1
- How to configure add Redis Datasource in values.yaml
- Unable to connect to Redis Datasource via Grafana Cloud HOT 3
- Unable to hide Redis query data HOT 2
- Is this still maintained? HOT 23
- CLIENT INFO fails HOT 5
- TS.MRANGE sometimes doesn't display key in the panel HOT 4
- TS.MRANGE works intermittently HOT 2
- Add FILTER_BY_VALUE support to TS.RANGE and TS.MRANGE
- How to query a value of key without bracket ? HOT 4
- Is it possible to return multiple options when querying an array of json, instead of a single stringified array, in the Grafana dashboard? HOT 3
- Provided dashboards broken in Grafana v10
- Grafana Live: Prevent panels from going blank during dashboard refresh
- docker image Ubuntu basic import redis-datasource-2.2.0
- High and Mediuma CVEs present in latest image (2.2.0)
- TS.MRANGE LATEST HOT 1
- Building
- OSS Redis Cluster: getInstance error: cannot decode redis array into string HOT 1
- Add Support for Grafana PDC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grafana-redis-datasource.