diff --git a/trace/traceDetailHand.go b/trace/traceDetailHand.go new file mode 100644 index 000000000..1cdffdd54 --- /dev/null +++ b/trace/traceDetailHand.go @@ -0,0 +1,23 @@ +package trace + +import ( + "fmt" +) + +// TraceDetailHand 手动埋点 +type TraceDetailHand struct { + BaseTraceDetail + Name string +} + +func (receiver *TraceDetailHand) GetTraceDetail() *BaseTraceDetail { + return &receiver.BaseTraceDetail +} + +func (receiver *TraceDetailHand) ToString() string { + return fmt.Sprintf("[%s]耗时:%s, %s", receiver.CallType.ToString(), receiver.UseTs.String(), receiver.Name) +} + +func (receiver *TraceDetailHand) SetName(name string) { + receiver.Name = name +} diff --git a/trace/trackContext.go b/trace/trackContext.go index a9c1cf178..9680e499e 100644 --- a/trace/trackContext.go +++ b/trace/trackContext.go @@ -101,7 +101,10 @@ func (receiver *TraceContext) IgnoreDetail(f func()) { receiver.ignoreDetail = false }() - traceDetail := NewTraceDetail(eumCallType.Hand, "") + traceDetail := TraceDetailHand{ + BaseTraceDetail: NewTraceDetail(eumCallType.Hand, ""), + Name: "忽略明细", + } traceDetail.Comment = "忽略明细" traceDetail.Timeline = time.Duration(traceDetail.StartTs-receiver.StartTs) * time.Microsecond if len(receiver.List) > 0 {