Skip to content

Commit

Permalink
v0.0.21 release~!!
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Dec 28, 2023
1 parent c41b15c commit 0e5e6ea
Show file tree
Hide file tree
Showing 15 changed files with 571 additions and 40 deletions.
18 changes: 11 additions & 7 deletions lang/APEnum.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package lang

import ()

const (
APP_TYPE_PYTHON = 3
APP_TYPE_PHP = 4
APP_TYPE_ALL = 0
APP_TYPE_JAVA = 1
APP_TYPE_NODE = 2
APP_TYPE_PYTHON = 3
APP_TYPE_PHP = 4
APP_TYPE_URL_ADM = 5

// BSM App Type
APP_TYPE_BSM = 6
APP_TYPE_DOTNET = 7
APP_TYPE_GO = 8
APP_TYPE_BSM = 6
APP_TYPE_DOTNET = 7
APP_TYPE_GO = 8
APP_TYPE_WEB_CHECK = 9
APP_TYPE_OTEL = 10

// Php, Python 로직 분기로 분기
APP_TYPE_BSM_PYTHON = 20
Expand Down
3 changes: 2 additions & 1 deletion lang/pack/TagLogPack.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func (this *TagLogPack) Put(name string, v interface{}) {
case string:
this.Fields.Put(name, value.NewTextValue(v.(string)))
default:
panic(fmt.Sprintf("Panic, Not supported type %T. available type: value.Value, int, int32, int64, float32, float64, string ", v))
//panic(fmt.Sprintf("Panic, Not supported type %T. available type: value.Value, int, int32, int64, float32, float64, string ", v))
this.Fields.Put(name, value.NewTextValue(fmt.Sprintf("%v", v)))
}
}

Expand Down
16 changes: 8 additions & 8 deletions lang/pack/ZipPack.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const ()
type ZipPack struct {
AbstractPack

Records []byte
RecountCount int
Status byte
Records []byte
RecordCount int
Status byte
}

func NewZipPack() *ZipPack {
Expand All @@ -34,20 +34,20 @@ func (this *ZipPack) Write(dout *io.DataOutputX) {
this.AbstractPack.Write(dout)

dout.WriteByte(this.Status)
dout.WriteDecimal(int64(this.RecountCount))
dout.WriteDecimal(int64(this.RecordCount))
dout.WriteBlob(this.Records)
}

func (this *ZipPack) Read(din *io.DataInputX) {
this.AbstractPack.Read(din)

this.Status = din.ReadByte()
this.RecountCount = int(din.ReadDecimal())
this.RecordCount = int(din.ReadDecimal())
this.Records = din.ReadBlob()
}

//public ZipPack setRecords(int size, Enumeration<AbstractPack> items) {
// this.recountCount=size;
// this.RecordCount=size;
// DataOutputX o = new DataOutputX();
// for (int i = 0; i < size; i++) {
// o.writePack(items.nextElement());
Expand All @@ -57,7 +57,7 @@ func (this *ZipPack) Read(din *io.DataInputX) {
// }

func (this *ZipPack) SetRecords(items []Pack) *ZipPack {
this.RecountCount = len(items)
this.RecordCount = len(items)
o := io.NewDataOutputX()
for _, it := range items {
o = WritePack(o, it)
Expand All @@ -72,7 +72,7 @@ func (this *ZipPack) GetRecords() []Pack {
return nil
}
in := io.NewDataInputX(this.Records)
for i := 0; i < this.RecountCount; i++ {
for i := 0; i < this.RecordCount; i++ {
p := ReadPack(in)

p.SetPCODE(this.Pcode)
Expand Down
16 changes: 15 additions & 1 deletion lang/pack/udp/AbstractPack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type AbstractPack struct {
Mem int64
Pid int32
ThreadId int64
Index int32
Parent int32

Flush bool
}
Expand All @@ -31,6 +33,8 @@ func (this *AbstractPack) Clear() {
this.Mem = 0
this.Pid = 0
this.ThreadId = 0
this.Index = -1
this.Parent = -1

this.Flush = false
}
Expand Down Expand Up @@ -65,8 +69,11 @@ func (this *AbstractPack) Write(dout *io.DataOutputX) {
if this.Ver >= 10104 {
dout.WriteLong(this.ThreadId)
}
if this.Ver >= 10109 {
dout.WriteInt(this.Index)
dout.WriteInt(this.Parent)
}
}

}
func (this *AbstractPack) Read(din *io.DataInputX) {
this.Txid = din.ReadLong()
Expand All @@ -92,13 +99,20 @@ func (this *AbstractPack) Read(din *io.DataInputX) {
this.Pid = din.ReadInt()
this.ThreadId = din.ReadLong()
} else {
// reset
this.Index = -1
this.Parent = -1
// PHP
if this.Ver >= 10101 {
this.Pid = din.ReadInt()
}
if this.Ver >= 10104 {
this.ThreadId = din.ReadLong()
}
if this.Ver >= 10109 {
this.Index = din.ReadInt()
this.Parent = din.ReadInt()
}
}
}

Expand Down
24 changes: 24 additions & 0 deletions lang/pack/udp/UdpTxEndPack.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type UdpTxEndPack struct {

Status int32

McallerStepId int64
XTraceId string

// Processing data
ServiceURL *urlutil.URL
McallerUrlHash int32
Expand Down Expand Up @@ -73,6 +76,9 @@ func (this *UdpTxEndPack) Clear() {

this.Status = 0

this.McallerStepId = 0
this.XTraceId = ""

// Processing data
this.ServiceURL = nil
this.McallerUrlHash = 0
Expand All @@ -98,6 +104,10 @@ func (this *UdpTxEndPack) Write(dout *io.DataOutputX) {
if this.Ver >= 50100 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(int64(this.Status)))
}
if this.Ver >= 50101 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.McallerStepId))
dout.WriteTextShortLength(this.XTraceId)
}
} else if this.Ver > 40000 {
// Batch
} else if this.Ver > 30000 {
Expand Down Expand Up @@ -135,6 +145,11 @@ func (this *UdpTxEndPack) Write(dout *io.DataOutputX) {
if this.Ver >= 10107 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(int64(this.Status)))
}

if this.Ver >= 10108 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.McallerStepId))
dout.WriteTextShortLength(this.XTraceId)
}
}
}

Expand All @@ -155,6 +170,10 @@ func (this *UdpTxEndPack) Read(din *io.DataInputX) {
if this.Ver >= 50100 {
this.Status = stringutil.ParseInt32(din.ReadTextShortLength())
}
if this.Ver >= 50101 {
this.McallerStepId = stringutil.ParseInt64(din.ReadTextShortLength())
this.XTraceId = din.ReadTextShortLength()
}

} else if this.Ver > 40000 {
// Batch
Expand Down Expand Up @@ -194,6 +213,11 @@ func (this *UdpTxEndPack) Read(din *io.DataInputX) {
// reponse code
this.Status = stringutil.ParseInt32(din.ReadTextShortLength())
}

if this.Ver >= 10108 {
this.McallerStepId = stringutil.ParseInt64(din.ReadTextShortLength())
this.XTraceId = din.ReadTextShortLength()
}
}
}
func (this *UdpTxEndPack) Process() {
Expand Down
26 changes: 13 additions & 13 deletions lang/pack/udp/UdpTxHttpcPack.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type UdpTxHttpcPack struct {
AbstractPack
// Pack
Url string
Mcallee int64
StepId int64
ErrorType string
ErrorMessage string
Stack string
Expand All @@ -38,15 +38,15 @@ func (this *UdpTxHttpcPack) GetPackType() uint8 {
}

func (this *UdpTxHttpcPack) ToString() string {
return fmt.Sprint(this.AbstractPack.ToString(), ",Url=", this.Url, ",Callee=", this.Mcallee)
return fmt.Sprint(this.AbstractPack.ToString(), ",Url=", this.Url, ",Callee=", this.StepId)
}

func (this *UdpTxHttpcPack) Clear() {
this.AbstractPack.Clear()
this.AbstractPack.Flush = false

this.Url = ""
this.Mcallee = 0
this.StepId = 0
this.ErrorType = ""
this.ErrorMessage = ""
this.Stack = ""
Expand All @@ -61,29 +61,29 @@ func (this *UdpTxHttpcPack) Write(dout *io.DataOutputX) {

if this.Ver > 50000 {
// Golang
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.Mcallee))
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.StepId))
dout.WriteTextShortLength(this.ErrorType)
dout.WriteTextShortLength(this.ErrorMessage)
dout.WriteTextShortLength(this.Stack)
} else if this.Ver > 40000 {
// Batch
} else if this.Ver > 30000 {
// Dotnet
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.Mcallee))
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.StepId))
dout.WriteTextShortLength(this.ErrorType)
dout.WriteTextShortLength(this.ErrorMessage)
dout.WriteTextShortLength(this.Stack)
} else if this.Ver > 20000 {
// Python
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.Mcallee))
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.StepId))
} else {
if this.Ver >= 10105 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.Mcallee))
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.StepId))
dout.WriteTextShortLength(this.ErrorType)
dout.WriteTextShortLength(this.ErrorMessage)
dout.WriteTextShortLength(this.Stack)
} else if this.Ver >= 10102 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.Mcallee))
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.StepId))
}
}
}
Expand All @@ -95,30 +95,30 @@ func (this *UdpTxHttpcPack) Read(din *io.DataInputX) {

if this.Ver > 50000 {
// Golang
this.Mcallee = stringutil.ParseInt64(din.ReadTextShortLength())
this.StepId = stringutil.ParseInt64(din.ReadTextShortLength())
this.ErrorType = din.ReadTextShortLength()
this.ErrorMessage = din.ReadTextShortLength()
this.Stack = din.ReadTextShortLength()
} else if this.Ver > 40000 {
// Batch
} else if this.Ver > 30000 {
// Dotnet
this.Mcallee = stringutil.ParseInt64(din.ReadTextShortLength())
this.StepId = stringutil.ParseInt64(din.ReadTextShortLength())
this.ErrorType = din.ReadTextShortLength()
this.ErrorMessage = din.ReadTextShortLength()
this.Stack = din.ReadTextShortLength()
} else if this.Ver > 20000 {
// Python
this.Mcallee = stringutil.ParseInt64(din.ReadTextShortLength())
this.StepId = stringutil.ParseInt64(din.ReadTextShortLength())
} else {
// PHP
if this.Ver >= 10105 {
this.Mcallee = stringutil.ParseInt64(din.ReadTextShortLength())
this.StepId = stringutil.ParseInt64(din.ReadTextShortLength())
this.ErrorType = din.ReadTextShortLength()
this.ErrorMessage = din.ReadTextShortLength()
this.Stack = din.ReadTextShortLength()
} else if this.Ver >= 10102 {
this.Mcallee = stringutil.ParseInt64(din.ReadTextShortLength())
this.StepId = stringutil.ParseInt64(din.ReadTextShortLength())
}
}
}
Expand Down
43 changes: 43 additions & 0 deletions lang/pack/udp/UdpTxStartEndPack.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ type UdpTxStartEndPack struct {
McallerUrl string
McallerPoidKey string

Status int32

McallerStepId int64
XTraceId string

//Processing data
ServiceURL *urlutil.URL
RefererURL *urlutil.URL
Expand Down Expand Up @@ -84,6 +89,10 @@ func (this *UdpTxStartEndPack) Clear() {
this.McallerUrl = ""
this.McallerPoidKey = ""

this.Status = 0
this.McallerStepId = 0
this.XTraceId = ""

//Processing data
this.ServiceURL = nil
this.RefererURL = nil
Expand Down Expand Up @@ -117,6 +126,13 @@ func (this *UdpTxStartEndPack) Write(dout *io.DataOutputX) {
dout.WriteTextShortLength(this.McallerSpec)
dout.WriteTextShortLength(this.McallerUrl)
dout.WriteTextShortLength(this.McallerPoidKey)
if this.Ver >= 50100 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(int64(this.Status)))
}
if this.Ver >= 50101 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.McallerStepId))
dout.WriteTextShortLength(this.XTraceId)
}
} else if this.Ver > 40000 {
// Batch
} else if this.Ver > 30000 {
Expand Down Expand Up @@ -145,6 +161,15 @@ func (this *UdpTxStartEndPack) Write(dout *io.DataOutputX) {
dout.WriteTextShortLength(this.McallerSpec)
dout.WriteTextShortLength(this.McallerUrl)
dout.WriteTextShortLength(this.McallerPoidKey)

if this.Ver >= 10107 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(int64(this.Status)))
}

if this.Ver >= 10108 {
dout.WriteTextShortLength(stringutil.ParseStringZeroToEmpty(this.McallerStepId))
dout.WriteTextShortLength(this.XTraceId)
}
}
}

Expand All @@ -168,6 +193,14 @@ func (this *UdpTxStartEndPack) Read(din *io.DataInputX) {
this.McallerSpec = din.ReadTextShortLength()
this.McallerUrl = din.ReadTextShortLength()
this.McallerPoidKey = din.ReadTextShortLength()
if this.Ver >= 50100 {
this.Status = stringutil.ParseInt32(din.ReadTextShortLength())
}
if this.Ver >= 50101 {
this.McallerStepId = stringutil.ParseInt64(din.ReadTextShortLength())
this.XTraceId = din.ReadTextShortLength()
}

} else if this.Ver > 40000 {
// Batch
} else if this.Ver > 30000 {
Expand Down Expand Up @@ -196,6 +229,16 @@ func (this *UdpTxStartEndPack) Read(din *io.DataInputX) {
this.McallerSpec = din.ReadTextShortLength()
this.McallerUrl = din.ReadTextShortLength()
this.McallerPoidKey = din.ReadTextShortLength()

if this.Ver >= 10107 {
// reponse code
this.Status = stringutil.ParseInt32(din.ReadTextShortLength())
}

if this.Ver >= 10108 {
this.McallerStepId = stringutil.ParseInt64(din.ReadTextShortLength())
this.XTraceId = din.ReadTextShortLength()
}
}
}

Expand Down
Loading

0 comments on commit 0e5e6ea

Please sign in to comment.