Archived
国家/地区统计时上传流量、攻击量等信息
This commit is contained in:
@@ -212,11 +212,6 @@ func (this *HTTPRequest) doBegin() {
|
||||
}
|
||||
}
|
||||
|
||||
// 统计
|
||||
if this.web.StatRef != nil && this.web.StatRef.IsOn {
|
||||
this.doStat()
|
||||
}
|
||||
|
||||
// 跳转
|
||||
if len(this.web.HostRedirects) > 0 {
|
||||
if this.doHostRedirect() {
|
||||
@@ -298,6 +293,12 @@ func (this *HTTPRequest) doEnd() {
|
||||
if metrics.SharedManager.HasHTTPMetrics() {
|
||||
this.doMetricsResponse()
|
||||
}
|
||||
|
||||
// 统计
|
||||
if this.web.StatRef != nil && this.web.StatRef.IsOn {
|
||||
// 放到最后执行
|
||||
this.doStat()
|
||||
}
|
||||
}
|
||||
|
||||
// RawURI 原始的请求URI
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package nodes
|
||||
|
||||
import "github.com/TeaOSLab/EdgeNode/internal/stats"
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeNode/internal/stats"
|
||||
)
|
||||
|
||||
// 统计
|
||||
func (this *HTTPRequest) doStat() {
|
||||
@@ -9,6 +11,6 @@ func (this *HTTPRequest) doStat() {
|
||||
}
|
||||
|
||||
// 内置的统计
|
||||
stats.SharedHTTPRequestStatManager.AddRemoteAddr(this.Server.Id, this.requestRemoteAddr(true))
|
||||
stats.SharedHTTPRequestStatManager.AddRemoteAddr(this.Server.Id, this.requestRemoteAddr(true), this.writer.SentBodyBytes(), this.isAttack)
|
||||
stats.SharedHTTPRequestStatManager.AddUserAgent(this.Server.Id, this.requestHeader("User-Agent"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user