系统在进行健康检查时不进行指标统计

This commit is contained in:
GoEdgeLab
2023-09-12 10:45:44 +08:00
parent 33fb5cfb11
commit f43ad5a9d5

View File

@@ -47,6 +47,7 @@ type HTTPRequest struct {
IsHTTP bool
IsHTTPS bool
IsHTTP3 bool
isHealthCheck bool
// 共享参数
nodeConfig *nodeconfigs.NodeConfig
@@ -168,10 +169,9 @@ func (this *HTTPRequest) Do() {
}
// 处理健康检查
var isHealthCheck = false
var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName)
if len(healthCheckKey) > 0 {
if this.doHealthCheck(healthCheckKey, &isHealthCheck) {
if this.doHealthCheck(healthCheckKey, &this.isHealthCheck) {
this.doEnd()
return
}
@@ -205,7 +205,7 @@ func (this *HTTPRequest) Do() {
}
// UAM
if !isHealthCheck {
if !this.isHealthCheck {
if this.web.UAM != nil {
if this.web.UAM.IsOn {
if this.doUAM() {
@@ -223,7 +223,7 @@ func (this *HTTPRequest) Do() {
}
// CC
if !isHealthCheck {
if !this.isHealthCheck {
if this.web.CC != nil {
if this.web.CC.IsOn {
if this.doCC() {
@@ -388,7 +388,7 @@ func (this *HTTPRequest) doEnd() {
// 流量统计
// TODO 增加是否开启开关
if this.ReqServer != nil && this.ReqServer.Id > 0 {
if this.ReqServer != nil && this.ReqServer.Id > 0 && !this.isHealthCheck /** 健康检查时不统计 **/ {
var totalBytes int64 = 0
var requestConn = this.RawReq.Context().Value(HTTPConnContextKey)