访问日志简化requestId生成方法

This commit is contained in:
刘祥超
2021-11-21 10:27:31 +08:00
parent 40cb1916c2
commit ac069fd7f3
2 changed files with 19 additions and 9 deletions

View File

@@ -3,14 +3,10 @@ package nodes
import (
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"strconv"
"strings"
"sync/atomic"
"time"
)
var requestId int64 = 1_0000_0000_0000_0000
// 日志
func (this *HTTPRequest) log() {
if this.disableLog {
@@ -85,7 +81,7 @@ func (this *HTTPRequest) log() {
}
accessLog := &pb.HTTPAccessLog{
RequestId: strconv.FormatInt(this.requestFromTime.UnixNano(), 10) + strconv.FormatInt(atomic.AddInt64(&requestId, 1), 10) + sharedNodeConfig.PaddedId(),
RequestId: "",
NodeId: sharedNodeConfig.Id,
ServerId: this.Server.Id,
RemoteAddr: this.requestRemoteAddr(true),