Trace sdk (#65)

* trace sdk initial commit.

* fix imports and comments.

* remove tracestate

* split trace.go

* add attribute over limit test.

* add comments and restructure span.go and tracer.go

* refactor MessageEvent

* defer unlock

* some more cleanup in span.go

* rename *MessageEvent* to *Event*

* cleanup comments in trace_test.go

* fix typos.

* return full string ID for traceID and spanID.
This commit is contained in:
rghetia
2019-08-02 13:52:55 -07:00
committed by GitHub
parent ed3b26b6c8
commit 0f32efcdaa
28 changed files with 2082 additions and 10 deletions
+2 -3
View File
@@ -53,14 +53,13 @@ func (sc SpanContext) HasSpanID() bool {
}
func (sc SpanContext) SpanIDString() string {
p := fmt.Sprintf("%.16x", sc.SpanID)
return p[0:3] + ".." + p[13:16]
return fmt.Sprintf("%.16x", sc.SpanID)
}
func (sc SpanContext) TraceIDString() string {
p1 := fmt.Sprintf("%.16x", sc.TraceID.High)
p2 := fmt.Sprintf("%.16x", sc.TraceID.Low)
return p1[0:3] + ".." + p2[13:16]
return p1 + p2
}
func (sc SpanContext) IsSampled() bool {
+4 -4
View File
@@ -88,11 +88,11 @@ func TestSpanIDString(t *testing.T) {
{
name: "fourtytwo",
sc: SpanContext{SpanID: uint64(42)},
want: `000..02a`,
want: `000000000000002a`,
}, {
name: "empty",
sc: SpanContext{},
want: `000..000`,
want: `0000000000000000`,
},
} {
t.Run(testcase.name, func(t *testing.T) {
@@ -119,11 +119,11 @@ func TestTraceIDString(t *testing.T) {
Low: uint64(42),
},
},
want: `000..02a`,
want: `000000000000002a000000000000002a`,
}, {
name: "empty",
sc: SpanContext{TraceID: TraceID{}},
want: `000..000`,
want: `00000000000000000000000000000000`,
},
} {
t.Run(testcase.name, func(t *testing.T) {