Go API Documentation

github.com/TykTechnologies/tyk/trace/jaeger

No package summary is available.

Package

Files: 2. Third party imports: 3. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Constants

// Name is the name of this tracer.
const Name = "jaeger"

Types

Logger

This type doesn't have documentation.

Field name Field type Comment
type

any

No comment on field.
type Logger interface {
	Errorf(msg string, args ...interface{})
	Infof(msg string, args ...interface{})
}

Trace

This type doesn't have documentation.

Field name Field type Comment

opentracing.Tracer

No comment on field.

io.Closer

No comment on field.
type Trace struct {
	opentracing.Tracer
	io.Closer
}

wrapLogger

This type doesn't have documentation.

Field name Field type Comment

Logger

No comment on field.
type wrapLogger struct {
	Logger
}

Functions

func Init

Init returns a implementation of tyk.Tracer using jaeger client.

func Init(service string, opts map[string]interface{}, log Logger) (*Trace, error) {
	cfg, err := Load(opts)
	if service != "" {
		cfg.ServiceName = service
	}
	tr, cls, err := cfg.NewTracer(
		config.Logger(&wrapLogger{Logger: log}),
	)
	if err != nil {
		return nil, err
	}
	return &Trace{Tracer: tr, Closer: cls}, nil
}

Cognitive complexity: 7, Cyclomatic complexity: 3

Uses: config.Logger.

func Load

Load returns jaeger configuration from opts. Please see jaeger configuration for details about the key value pairs

https://github.com/jaegertracing/jaeger-client-go/blob/master/config/config.go#L37

func Load(opts map[string]interface{}) (*config.Configuration, error) {
	// The object opts is loaded from json. Instead of decoding every single value
	// by had we marshal to then to yaml.
	//
	// This is possible because the tags are the same for both json and yaml.
	b, err := yaml.Marshal(opts)
	if err != nil {
		return nil, err
	}
	var c config.Configuration
	err = yaml.Unmarshal(b, &c)
	if err != nil {
		return nil, err
	}
	return &c, nil
}

Cognitive complexity: 5, Cyclomatic complexity: 3

Uses: config.Configuration, yaml.Marshal, yaml.Unmarshal.

func (Trace) Name

func (Trace) Name() string {
	return Name
}

Cognitive complexity: 0, Cyclomatic complexity: 1

func (wrapLogger) Error

func (w wrapLogger) Error(msg string) {
	w.Errorf("%s", msg)
}

Cognitive complexity: 0, Cyclomatic complexity: 1


Tests

Files: 1. Third party imports: 2. Imports from organisation: 0. Tests: 1. Benchmarks: 0.

Test functions

TestLoad

References: config.Configuration, config.ReporterConfig, config.SamplerConfig, jaeger.SamplerOption, jaeger.SamplerTypeConst, reflect.DeepEqual, tykconf.Config, tykconf.Load.