go-platform: github.com/micro/go-platform/trace Index | Files | Directories

package trace

import "github.com/micro/go-platform/trace"

Package trace is an interface for tracing.

Index

Package Files

context.go options.go os.go trace.go util.go wrapper.go

Variables

var (
    DefaultBatchSize     = 100
    DefaultBatchInterval = time.Second * 5

    TraceTopic   = "micro.trace.span"
    TraceHeader  = "X-Micro-Trace-Id"
    SpanHeader   = "X-Micro-Span-Id"
    ParentHeader = "X-Micro-Parent-Id"
    DebugHeader  = "X-Micro-Trace-Debug"
)

func ClientWrapper Uses

func ClientWrapper(t Trace, s *registry.Service) client.Wrapper

func ContextWithSpan Uses

func ContextWithSpan(ctx context.Context, s *Span) context.Context

func HandlerWrapper Uses

func HandlerWrapper(t Trace, s *registry.Service) server.HandlerWrapper

func HeaderWithSpan Uses

func HeaderWithSpan(md map[string]string, s *Span) map[string]string

func NewContext Uses

func NewContext(ctx context.Context, c Trace) context.Context

type Annotation Uses

type Annotation struct {
    Timestamp time.Time // Microseconds from epoch
    Type      AnnotationType
    Key       string
    Value     []byte
    Debug     map[string]string
    Service   *registry.Service // Annotator
}

type AnnotationType Uses

type AnnotationType int32
const (
    AnnUnknown            AnnotationType = 0
    AnnStart              AnnotationType = 1
    AnnEnd                AnnotationType = 2
    AnnTimeout            AnnotationType = 3
    AnnClientRequest      AnnotationType = 4
    AnnClientResponse     AnnotationType = 5
    AnnClientPublication  AnnotationType = 6
    AnnServerRequest      AnnotationType = 7
    AnnServerResponse     AnnotationType = 8
    AnnServerSubscription AnnotationType = 9
)

type Option Uses

type Option func(o *Options)

func BatchInterval Uses

func BatchInterval(b time.Duration) Option

func BatchSize Uses

func BatchSize(b int) Option

func Client Uses

func Client(c client.Client) Option

func CollectTimeout Uses

func CollectTimeout(t time.Duration) Option

func Collectors Uses

func Collectors(c ...string) Option

func Service Uses

func Service(s *registry.Service) Option

func Topic Uses

func Topic(t string) Option

type Options Uses

type Options struct {
    BatchSize      int
    BatchInterval  time.Duration
    CollectTimeout time.Duration
    Collectors     []string
    Topic          string

    Client  client.Client
    Service *registry.Service
}

type Span Uses

type Span struct {
    Name      string        // Topic / RPC Method
    Id        string        // id of this span
    TraceId   string        // The root trace id
    ParentId  string        // Parent span id
    Timestamp time.Time     // Microseconds from epoch. When span started.
    Duration  time.Duration // Microseconds. Duration of the span.
    Debug     bool          // Should persist no matter what.

    Source      *registry.Service // Originating service
    Destination *registry.Service // Destination service

    sync.Mutex
    Annotations []*Annotation
}

func SpanFromContext Uses

func SpanFromContext(ctx context.Context) (*Span, bool)

func SpanFromHeader Uses

func SpanFromHeader(md map[string]string) (*Span, bool)

type Trace Uses

type Trace interface {
    Close() error
    // New span with certain fields preset.
    // Provide parent span if you have it.
    NewSpan(*Span) *Span
    // Collect spans
    Collect(*Span) error
    // Name
    String() string
}

func FromContext Uses

func FromContext(ctx context.Context) (Trace, bool)

func NewTrace Uses

func NewTrace(opts ...Option) Trace

Directories

PathSynopsis
protoPackage go_micro_os_trace is a generated protocol buffer package.

Package trace imports 10 packages (graph) and is imported by 6 packages. Updated 2018-02-20. Refresh now. Tools for package owners.