provider

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package provider

Package provider

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJaegerProvider

func NewJaegerProvider(serviceName, endpoint string, options ...Option) (*sdkTrace.TracerProvider, error)

NewJaegerProvider returns an OpenTelemetry TracerProvider configured to use the Jaeger exporter that will send spans to the provided url. The returned TracerProvider will also use a Resource configured with all the information about the application.

func NewTracerProvider

func NewTracerProvider(ctx context.Context, client otlptrace.Client, serviceName string) (*sdkTrace.TracerProvider, error)

NewTracerProvider serviceName 服务名称,一般是apollo上面的服务名称,注意冲突 http:

client := otlptracehttp.NewClient(

otlptracehttp.WithEndpoint(endpoint),
otlptracehttp.WithInsecure(),
otlptracehttp.WithRetry(otlptracehttp.RetryConfig{
	Enabled:         true,
	InitialInterval: 1 * time.Second,
	MaxInterval:     1 * time.Second,
	MaxElapsedTime:  0,
}))

grpc: client := otlptracegrpc.NewClient(

otlptracegrpc.WithEndpoint(endpoint),
otlptracegrpc.WithInsecure(),
otlptracegrpc.WithReconnectionPeriod(50*time.Millisecond),
otlptracegrpc.WithRetry(otlptracegrpc.RetryConfig{
	Enabled:         true,
	InitialInterval: 1 * time.Second,
	MaxInterval:     1 * time.Second,
	MaxElapsedTime:  0,
}))

Types

type IDGenerator

type IDGenerator struct{}

func NewIDGenerator

func NewIDGenerator() *IDGenerator

func (*IDGenerator) NewIDs

func (id *IDGenerator) NewIDs(ctx context.Context) (traceID trace.TraceID, spanID trace.SpanID)

NewIDs creates and returns a new trace and span ID.

func (*IDGenerator) NewSpanID

func (id *IDGenerator) NewSpanID(ctx context.Context, traceID trace.TraceID) (spanID trace.SpanID)

NewSpanID returns an ID for a new span in the trace with traceID.

type Option

type Option func(c *Options)

Option is a function that sets some option on the client.

type Options

type Options struct {
	SamplingRatio float64
}

Options control behavior of the client.

Jump to

Keyboard shortcuts

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