在请求上下文中停用统计的时候也停用对应的指标统计

This commit is contained in:
刘祥超
2024-04-30 00:05:32 +08:00
parent bbb4b7d31a
commit c7d60e01b8
2 changed files with 5 additions and 1 deletions

View File

@@ -103,6 +103,8 @@ type HTTPRequest struct {
disableLog bool // 是否在当前请求中关闭Log
forceLog bool // 是否强制记录日志
disableMetrics bool // 不记录统计指标
isHijacked bool
// script相关操作
@@ -458,7 +460,7 @@ func (this *HTTPRequest) doEnd() {
stats.SharedDAUManager.AddIP(this.ReqServer.Id, this.requestRemoteAddr(true))
// 指标
if metrics.SharedManager.HasHTTPMetrics() {
if !this.disableMetrics && metrics.SharedManager.HasHTTPMetrics() {
this.doMetricsResponse()
}

View File

@@ -546,4 +546,6 @@ func (this *HTTPRequest) DisableStat() {
if this.web != nil {
this.web.StatRef = nil
}
this.disableMetrics = true
}