[英]How to change the columns titles In Grafana using ElasticSearch
I use Grafana to display ElasticSearch results in a table. 我使用Grafana在表中显示ElasticSearch结果。 The table's column names are the values of the term that is the results are grouped by.
该表的列名称是将结果分组的术语的值。
In my case: I use the Average aggregation on the term "upgrade_time" and I group the results by the term "db_name". 在我的情况下:我对“ upgrade_time”一词使用“平均”聚合,并根据“ db_name”一词对结果进行分组。
How can I set the column name to show "Average Upgrade Time for db1", "Average Upgrade Time for db2", etc...? 如何设置列名称以显示“ db1的平均升级时间”,“ db2的平均升级时间”等?
With ElasticSearch 6.4 and Grafana 6.2.5, the versions I am using you can use "Series naming & alias patterns" 对于ElasticSearch 6.4和Grafana 6.2.5,我正在使用的版本可以使用“系列命名和别名模式”
eg, 例如,
Lets say you display the average value of the field "upgrade time" aggregated by the term "db_name" . 假设您显示字段“ upgrade time”的平均值 ,该字段由术语“ db_name”聚合。 By default, when no alias pattern is used, you will get columns titled: "db1", "db2", etc...
默认情况下,当不使用别名模式时,您将获得标题为“ db1”,“ db2”等的列。
You can then use the pattern 然后可以使用该模式
RESULT_FOR_{{db_name}}
to change the titles to: "RESULT_FOR_db1" , "RESULT_FOR_db2", etc... 将标题更改为: “ RESULT_FOR_db1” ,“ RESULT_FOR_db2”,等等。
If you use the alias pattern 如果使用别名模式
{{metric}}
the title will be "Average" for all columns, because the calculation used is the average function 所有列的标题均为“ Average”,因为使用的计算是平均值函数
If you use {{metric}}_{{db_name}}, the titles will be: "Average_db1" , "Average_db2", etc... 如果您使用{{metric}} _ {{db_name}},则标题将为: “ Average_db1” ,“ Average_db2”,等等。
If you use 如果您使用
{{metric}}_{{field}}_{{db_name}}
the titles will be: "Average_upgrade_time_db1" , "Average_upgrade_time_db2", etc..., because the aggregated field is "upgrade_time". 标题为: “ Average_upgrade_time_db1” ,“ Average_upgrade_time_db2”等,因为汇总字段为“ upgrade_time”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.