mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	增加内置统计指标:请求来源统计
This commit is contained in:
		@@ -20,7 +20,7 @@ import (
 | 
			
		||||
 | 
			
		||||
var LatestSQLResult = &SQLDumpResult{}
 | 
			
		||||
 | 
			
		||||
// 安装或升级SQL执行器
 | 
			
		||||
// SQLExecutor 安装或升级SQL执行器
 | 
			
		||||
type SQLExecutor struct {
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user