Trace type is now being recorded (#1188)

This commit is contained in:
Janos Dobronszki
2020-02-12 11:57:17 +01:00
committed by GitHub
parent 79ad1e6fe3
commit d76baf59de
5 changed files with 117 additions and 51 deletions

View File

@@ -3,8 +3,9 @@ package trace
import (
"context"
"github.com/micro/go-micro/v2/metadata"
"time"
"github.com/micro/go-micro/v2/metadata"
)
// Tracer is an interface for distributed tracing
@@ -17,6 +18,16 @@ type Tracer interface {
Read(...ReadOption) ([]*Span, error)
}
// SpanType describe the nature of the trace span
type SpanType int
const (
// SpanTypeRequestInbound is a span created when serving a request
SpanTypeRequestInbound SpanType = iota
// SpanTypeRequestOutbound is a span created when making a service call
SpanTypeRequestOutbound
)
// Span is used to record an entry
type Span struct {
// Id of the trace
@@ -33,6 +44,8 @@ type Span struct {
Duration time.Duration
// associated data
Metadata map[string]string
// Type
Type SpanType
}
const (