mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 10:00:25 +08:00
系统在进行健康检查时不进行指标统计
This commit is contained in:
@@ -47,6 +47,7 @@ type HTTPRequest struct {
|
|||||||
IsHTTP bool
|
IsHTTP bool
|
||||||
IsHTTPS bool
|
IsHTTPS bool
|
||||||
IsHTTP3 bool
|
IsHTTP3 bool
|
||||||
|
isHealthCheck bool
|
||||||
|
|
||||||
// 共享参数
|
// 共享参数
|
||||||
nodeConfig *nodeconfigs.NodeConfig
|
nodeConfig *nodeconfigs.NodeConfig
|
||||||
@@ -168,10 +169,9 @@ func (this *HTTPRequest) Do() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理健康检查
|
// 处理健康检查
|
||||||
var isHealthCheck = false
|
|
||||||
var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName)
|
var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName)
|
||||||
if len(healthCheckKey) > 0 {
|
if len(healthCheckKey) > 0 {
|
||||||
if this.doHealthCheck(healthCheckKey, &isHealthCheck) {
|
if this.doHealthCheck(healthCheckKey, &this.isHealthCheck) {
|
||||||
this.doEnd()
|
this.doEnd()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ func (this *HTTPRequest) Do() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UAM
|
// UAM
|
||||||
if !isHealthCheck {
|
if !this.isHealthCheck {
|
||||||
if this.web.UAM != nil {
|
if this.web.UAM != nil {
|
||||||
if this.web.UAM.IsOn {
|
if this.web.UAM.IsOn {
|
||||||
if this.doUAM() {
|
if this.doUAM() {
|
||||||
@@ -223,7 +223,7 @@ func (this *HTTPRequest) Do() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CC
|
// CC
|
||||||
if !isHealthCheck {
|
if !this.isHealthCheck {
|
||||||
if this.web.CC != nil {
|
if this.web.CC != nil {
|
||||||
if this.web.CC.IsOn {
|
if this.web.CC.IsOn {
|
||||||
if this.doCC() {
|
if this.doCC() {
|
||||||
@@ -388,7 +388,7 @@ func (this *HTTPRequest) doEnd() {
|
|||||||
|
|
||||||
// 流量统计
|
// 流量统计
|
||||||
// TODO 增加是否开启开关
|
// TODO 增加是否开启开关
|
||||||
if this.ReqServer != nil && this.ReqServer.Id > 0 {
|
if this.ReqServer != nil && this.ReqServer.Id > 0 && !this.isHealthCheck /** 健康检查时不统计 **/ {
|
||||||
var totalBytes int64 = 0
|
var totalBytes int64 = 0
|
||||||
|
|
||||||
var requestConn = this.RawReq.Context().Value(HTTPConnContextKey)
|
var requestConn = this.RawReq.Context().Value(HTTPConnContextKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user