grafana3-atlas-datasource
grafana3-atlas-datasource copied to clipboard
Template variables have values 0,1,2,..
Hi,
I'm configuring query-based template variables based on Atlas datasource. I found a way to make Atlas just return me array of values (IPs, in my case), like this: ["172.18.21.22", "172.18.52.8", "172.18.24.98"]
However, when I try to use these variables somewhere in dashboard, I see that plugin substitutes 0, 1, 2 instead of IP addresses. Looks like this is because of mapToTextValue function and mapping. Could you please tell, what was the reason to do it this way
return _.map(result.data, function (d, i) {
return {
text: d,
value: i
};
});
instead of this
return _.map(result.data, function (d) {
return {
text: d,
value: d
};
});
? I believe there must be some reason, maybe I'm doing something wrong, I don't know, but it feels like values should be same as text here, as people unlikely need indices instead of actual text representations.
Thank you in advance!
it has to do with the values showing in the query panel. If you do the values instead of index the metric names don't show up.
On Jan 14, 2018, at 10:33 AM, Mikhail Gromov [email protected] wrote:
Hi, I'm configuring query-based template variables based on Atlas datasource. I found a way to make Atlas just return me array of values (IPs, in my case), like this: ["172.18.21.22", "172.18.52.8", "172.18.24.98"] However, when I try to use these variables somewhere in dashboard, I see that plugin substitutes 0, 1, 2 instead of IP addresses. Looks like this is because of mapToTextValue function and mapping. Could you please tell, what was the reason to do it this way
return _.map(result.data, function (d, i) { return { text: d, value: i }; }); instead of this
return _.map(result.data, function (d) { return { text: d, value: d }; }); ? I believe there must be some reason, maybe I'm doing something wrong, I don't know, but it feels like values should be same as text here, as people unlikely need indices instead of actual text representations.
Thank you in advance!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I'm sorry, I don't understand, but how can developer use these variables then? If variables are substituted as 0,1,2,..., then it's hard to use them in clauses like
ip,[[ipAddress]],:eq,:and,
Is there any workaround?
We can add a checkbox to change the behavior, sounds like a good use case to me.