我有一个仪表板,其中包含一些变量(在本例中:类别和 URL):
{
"templating": {
"list": [
{
"allValue": null,
"current": {
"selected": false,
"text": "default",
"value": "default"
},
"datasource": "Influx-SP",
"definition": "",
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "category",
"options": [],
"query": "SHOW TAG VALUES WITH KEY = \"category\"",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"datasource": "Influx-SP",
"definition": "",
"error": null,
"hide": 0,
"includeAll": false,
"label": "group",
"multi": false,
"name": "group",
"options": [],
"query": "SHOW TAG VALUES WITH KEY = \"group\" WHERE \"category\" =~ /$category/",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"selected": false,
"text": "_",
"value": "_"
},
"datasource": "Influx-SP",
"definition": "",
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "page",
"options": [],
"query": "SHOW TAG VALUES WITH KEY = \"page\" WHERE \"group\" =~ /$group/ AND \"category\" =~ /$category/",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"selected": false,
"text": "chrome",
"value": "chrome"
},
"datasource": "Influx-SP",
"definition": "",
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "browser",
"options": [],
"query": "SHOW TAG VALUES WITH KEY = \"browser\" WHERE \"group\" =~ /$group/ AND \"page\" =~ /$page/ AND \"category\" =~ /$category/",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"selected": false,
"text": "native",
"value": "native"
},
"datasource": "Influx-SP",
"definition": "",
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "connectivity",
"options": [],
"query": "SHOW TAG VALUES WITH KEY = \"connectivity\" WHERE \"group\" =~ /$group/ AND \"page\" =~ /$page/ AND \"browser\" =~ /$browser/ AND \"category\" =~ /$category/",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
}
}
现在我想让用户查看特定网址的测量值。目前,该字段group
显示所有 URL,用户可以看到所有 url 的列表,无论他是否应该看到它(当然,这是因为查询SHOW TAG VALUES WITH KEY = \"group\" WHERE \"category\" =~ /$category/
返回所有条目)。
所以我想获得一些最佳实践来解决这个问题。不幸的是,文档并没有帮助我:-(