tracer

package
v1.6.2-rc10 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(opts ...Option) (*tracesdk.TracerProvider, error)

NewProvider create an instance of tracer provider

func NewSpan

func NewSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

NewSpan returns a new span from the global tracer. span must be completed with `defer span.End()` right after the call.

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the current span from a context.

Types

type Config

type Config struct {
	// ServiceName customize service name
	ServiceName string `yaml:"serviceName"`
	// EndPoint the jaeger endpoint
	EndPoint string `yaml:"endpoint"`
	// InstanceID MUST be unique for each instance of the same
	InstanceID string `yaml:"instanceID"`
	//SamplingRatio customize sampling ratio
	//ratio >= 1 will always sample (default),< 0 are treated as zero will no sample
	// if you set this to .5, half of traces will be sampled
	SamplingRatio string `yaml:"samplingRatio"`
}

Config is the config for tracer

type Option

type Option func(ops *optionParams) error

Option the tracer provider option

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint defines the full URL to the Jaeger HTTP Thrift collector

func WithInstanceID

func WithInstanceID(instanceID string) Option

WithInstanceID defines the instance id

func WithSamplingRatio added in v1.6.3

func WithSamplingRatio(samplingRatio string) Option

WithSamplingRatio defines the sampling ratio

func WithServiceName

func WithServiceName(name string) Option

WithServiceName defines service name

Jump to

Keyboard shortcuts

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