go-zero/core/trace/spancontext.go
chenquan 7c842f22d0
Add traceId to the response headers (#919)
* Add traceId to the request headers

* Add test cases

* Update refactor code
2021-08-17 10:12:08 +08:00

20 lines
317 B
Go

package trace
type spanContext struct {
traceId string
spanId string
}
func (sc spanContext) TraceId() string {
return sc.traceId
}
func (sc spanContext) SpanId() string {
return sc.spanId
}
func (sc spanContext) Visit(fn func(key, val string) bool) {
fn(TraceIdKey, sc.traceId)
fn(spanIdKey, sc.spanId)
}