tracer

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 23 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRemoteSampler added in v0.2.14

func NewRemoteSampler(ctx context.Context, serviceName string, fraction float64, opts ...RemoteSamplerOption) (sdktrace.Sampler, error)

NewRemoteSampler returns a sampler which decides to sample a given request or not based on the sampling rules set by users on AWS X-Ray console. Sampler also periodically polls sampling rules and sampling targets.

func NewTracerProvider

func NewTracerProvider(service, host, development string, port int, sampler trace.Sampler) (*trace.TracerProvider, error)

func SemVersion

func SemVersion() string

SemVersion is the semantic version to be supplied to tracer/meter creation.

func Version

func Version() string

Version is the current release version of the gin instrumentation.

Types

type FallbackSampler added in v0.2.4

type FallbackSampler struct {
	// contains filtered or unexported fields
}

FallbackSampler does the sampling at a rate of 1 req/sec and 5% of additional requests.

func NewFallbackSampler added in v0.2.4

func NewFallbackSampler(fraction float64) *FallbackSampler

NewFallbackSampler returns a FallbackSampler which samples 1 req/sec and additional 5% of requests using traceIDRatioBasedSampler.

func (*FallbackSampler) Description added in v0.2.4

func (fs *FallbackSampler) Description() string

Description returns description of the sampler being used.

func (*FallbackSampler) ShouldSample added in v0.2.4

func (fs *FallbackSampler) ShouldSample(parameters sdktrace.SamplingParameters) sdktrace.SamplingResult

ShouldSample implements the logic of borrowing 1 req/sec and then use traceIDRatioBasedSampler to sample 5% of additional requests.

type Jaeger

type Jaeger struct{}

Jaeger propagator serializes SpanContext to/from Jaeger Headers

Jaeger format:

uber-tracer-id: {tracer-id}:{span-id}:{parent-span-id}:{flags}

func (Jaeger) Extract

func (jaeger Jaeger) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context

Extract extracts a context from the carrier if it contains Jaeger headers.

func (Jaeger) Fields

func (jaeger Jaeger) Fields() []string

func (Jaeger) Inject

func (jaeger Jaeger) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

Inject injects a context to the carrier following jaeger format. The parent span ID is set to an dummy parent span id as the most implementations do.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option specifies instrumentation configuration options.

func WithName added in v0.2.1

func WithName(name string) Option

WithName name default Service

func WithPropagators

func WithPropagators(propagators propagation.TextMapPropagator) Option

WithPropagators specifies propagators to use for extracting information from the HTTP requests. If none are specified, global ones will be used.

func WithProvider added in v0.2.1

func WithProvider(provider oteltrace.TracerProvider) Option

WithProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.

type RemoteSamplerOption added in v0.2.14

type RemoteSamplerOption interface {
	// contains filtered or unexported methods
}

RemoteSamplerOption sets configuration on the sampler.

func WithEndpoint added in v0.2.14

func WithEndpoint(endpoint url.URL) RemoteSamplerOption

WithEndpoint sets custom proxy endpoint. If this option is not provided the default endpoint used will be http://127.0.0.1:2000.

func WithLogger added in v0.2.14

func WithLogger(l glog.ILogger) RemoteSamplerOption

WithLogger sets custom logging for remote sampling implementation. If this option is not provided the default logger used will be go-logr/stdr (https://github.com/go-logr/stdr).

func WithSamplingRulesPollingInterval added in v0.2.14

func WithSamplingRulesPollingInterval(polingInterval time.Duration) RemoteSamplerOption

WithSamplingRulesPollingInterval sets polling interval for sampling rules. If this option is not provided the default samplingRulesPollingInterval used will be 300 seconds.

type Server

type Server struct {
	Tracer         oteltrace.Tracer
	TracerProvider oteltrace.TracerProvider
	Propagators    propagation.TextMapPropagator
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Server

New returns *tracer.Server

func (*Server) FromContext added in v0.2.15

func (s *Server) FromContext(ctx context.Context) otelBaggage.Baggage

func (*Server) SpanFromContext added in v0.2.15

func (s *Server) SpanFromContext(ctx context.Context) otelTrace.Span

func (*Server) Stop

func (s *Server) Stop(ctx context.Context)

func (*Server) WithAttributes added in v0.2.15

func (s *Server) WithAttributes(attributes ...attribute.KeyValue) otelTrace.SpanStartEventOption

WithAttributes adds the attributes related to a span life-cycle event. These attributes are used to describe the work a Span represents when this option is provided to a Span's start or end events. Otherwise, these attributes provide additional information about the event being recorded (e.g. error, state change, processing progress, system event).

If multiple of these options are passed the attributes of each successive option will extend the attributes instead of overwriting. There is no guarantee of uniqueness in the resulting attributes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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