mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-12-29 22:36:36 +08:00
实现基础的统计指标
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user