コード例 #1
0
ファイル: main.go プロジェクト: simonjefford/kit
func (c loggingCollector) Collect(s *zipkin.Span) error {
	annotations := s.Encode().GetAnnotations()
	values := make([]string, len(annotations))
	for i, a := range annotations {
		values[i] = a.Value
	}
	c.Logger.Log(
		"trace_id", s.TraceID(),
		"span_id", s.SpanID(),
		"parent_span_id", s.ParentSpanID(),
		"annotations", strings.Join(values, " "),
	)
	return nil
}
コード例 #2
0
ファイル: zipkin_test.go プロジェクト: omnistream/kit
func (c *countingCollector) Collect(s *zipkin.Span) error {
	for _, annotation := range s.Encode().GetAnnotations() {
		c.annotations = append(c.annotations, annotation.GetValue())
	}
	return nil
}
コード例 #3
0
ファイル: kafka_test.go プロジェクト: qband/down
func testEqual(t *testing.T, want *zipkin.Span, got *zipkincore.Span) {
	if got.TraceId != want.TraceID() {
		t.Errorf("trace_id %d, want %d", got.TraceId, want.TraceID())
	}
	if got.Id != want.SpanID() {
		t.Errorf("id %d, want %d", got.Id, want.SpanID())
	}
	if got.ParentId == nil {
		if want.ParentSpanID() != 0 {
			t.Errorf("parent_id %d, want %d", got.ParentId, want.ParentSpanID())
		}
	} else if *got.ParentId != want.ParentSpanID() {
		t.Errorf("parent_id %d, want %d", got.ParentId, want.ParentSpanID())
	}
}