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

This commit is contained in:
GoEdgeLab
2024-04-30 00:05:32 +08:00
parent 0398c1ae34
commit 47860b1e4d
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()
}