实现基础的统计指标

This commit is contained in:
GoEdgeLab
2021-06-30 20:50:17 +08:00
parent 792ee549b8
commit 3bf67b8334
14 changed files with 1481 additions and 110 deletions

View File

@@ -42,7 +42,11 @@ type NodeConfig struct {
paddedId string
// firewall
firewallPolicies []*firewallconfigs.HTTPFirewallPolicy
// metrics
hasHTTPConnectionMetrics bool
}
// SharedNodeConfig 取得当前节点配置单例
@@ -144,11 +148,15 @@ func (this *NodeConfig) Init() error {
}
// metric items
this.hasHTTPConnectionMetrics = false
for _, item := range this.MetricItems {
err := item.Init()
if err != nil {
return err
}
if item.IsOn && item.HasHTTPConnectionValue() {
this.hasHTTPConnectionMetrics = true
}
}
return nil
@@ -202,6 +210,11 @@ func (this *NodeConfig) PaddedId() string {
return this.paddedId
}
// HasHTTPConnectionMetrics 是否含有HTTP连接数的指标
func (this *NodeConfig) HasHTTPConnectionMetrics() bool {
return this.hasHTTPConnectionMetrics
}
// 搜索WAF策略
func (this *NodeConfig) lookupWeb(web *serverconfigs.HTTPWebConfig) {
if web == nil || !web.IsOn {