1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-12-01 23:12:29 +02:00

add IsValid() for SpanContext (#46)

* add IsValid() for SpanContext

* add unit test
This commit is contained in:
thinkerou
2019-08-06 00:58:51 +08:00
committed by rghetia
parent 0f32efcdaa
commit 0a37b8f43e
2 changed files with 41 additions and 0 deletions

View File

@@ -44,6 +44,10 @@ var (
INVALID_SPAN_CONTEXT = SpanContext{}
)
func (sc SpanContext) IsValid() bool {
return sc.HasTraceID() && sc.HasSpanID()
}
func (sc SpanContext) HasTraceID() bool {
return sc.TraceID.High != 0 || sc.TraceID.Low != 0
}