增加内置统计指标:请求来源统计

This commit is contained in:
GoEdgeLab
2021-07-26 16:50:34 +08:00
parent 844ece8e95
commit fe3173bc0b

View File

@@ -20,7 +20,7 @@ import (
var LatestSQLResult = &SQLDumpResult{} var LatestSQLResult = &SQLDumpResult{}
// 安装或升级SQL执行器 // SQLExecutor 安装或升级SQL执行器
type SQLExecutor struct { type SQLExecutor struct {
dbConfig *dbs.DBConfig dbConfig *dbs.DBConfig
} }
@@ -379,6 +379,20 @@ func (this *SQLExecutor) checkMetricItems(db *dbs.DB) error {
} }
} }
{
err := createMetricItem("request_referer_host", serverconfigs.MetricItemCategoryHTTP, "请求来源统计", []string{"${referer.host}"}, 1, "day", "${countRequest}", []maps.Map{
{
"name": "请求来源排行",
"type": "bar",
"widthDiv": 0,
"code": "request_referer_host_bar",
},
})
if err != nil {
return err
}
}
return nil return nil
} }