tracing

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoopTracing = &Tracing{
	Tracer: zipkin.CreateNoopTracer(),
	closer: nil,
}

NoopTracing is the tracing doing nothing.

Functions

func CreateSpanWithContext added in v1.5.2

func CreateSpanWithContext(ctx context.Context, tracing *Tracing, spanName string, startTime time.Time) context.Context

CreateSpanWithContext creates new span with given name and starttime and adds it to the context.

Types

type Span

type Span interface {
	// Tracer returns the Tracer that created this Span.
	Tracer() zipkingo.Tracer

	// Context yields the SpanContext for this Span
	Context() zipkinmodel.SpanContext

	// Finish finishes the span.
	Finish()
	// Cancel cancels the span, it should be called before Finish called.
	// It will cancel all descendent spans.
	Cancel()

	// NewChild creates a child span.
	NewChild(name string) Span
	// NewChildWithStart creates a child span with start time.
	NewChildWithStart(name string, startAt time.Time) Span

	// SetName changes the span name.
	SetName(name string)

	// LogKV logs key:value for the span.
	//
	// The keys must all be strings. The values may be strings, numeric types,
	// bools, Go error instances, or arbitrary structs.
	//
	// Example:
	//
	//    span.LogKV(
	//        "event", "soft error",
	//        "type", "cache timeout",
	//        "waited.millis", 1500)
	LogKV(kvs ...interface{})

	// SetTag sets tag key and value.
	SetTag(key string, value string)
	// IsNoopSpan returns true if span is NoopSpan.
	IsNoopSpan() bool
}

Span is the span of the Tracing.

type Spec

type Spec struct {
	ServiceName string            `yaml:"serviceName" jsonschema:"required"`
	Tags        map[string]string `yaml:"tags" jsonschema:"omitempty"`
	Zipkin      *zipkin.Spec      `yaml:"zipkin" jsonschema:"omitempty"`
}

Spec describes Tracing.

type Tracing

type Tracing struct {
	Tracer *zipkingo.Tracer
	// contains filtered or unexported fields
}

Tracing is the tracing.

func New

func New(spec *Spec) (*Tracing, error)

New creates a Tracing.

func (*Tracing) Close

func (t *Tracing) Close() error

Close closes Tracing.

func (*Tracing) IsNoopTracer added in v1.4.1

func (t *Tracing) IsNoopTracer() bool

IsNoopTracer checks whether tracer is noop tracer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL