Documentation ¶
Index ¶
- Constants
- func ExtractSpanId(ctx context.Context) string
- func ExtractTraceId(ctx context.Context) string
- func MetadataFromContext(ctx context.Context) (md metadata.Metadata)
- func StartSpanFromMetadata(ctx context.Context, spanName string, md metadata.Metadata, ...) context.Context
- type Config
- type Option
- type OptionFunc
- type Tracer
- func (t *Tracer) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context
- func (t *Tracer) Inject(ctx context.Context, carrier propagation.TextMapCarrier)
- func (t *Tracer) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- type TracerOption
- type Tracing
Constants ¶
View Source
const (
// TraceName represents the tracing name.
TraceName = "opentelemetry"
)
Variables ¶
This section is empty.
Functions ¶
func ExtractSpanId ¶
ExtractSpanId returns the current Span's SpanID.
func ExtractTraceId ¶
ExtractTraceId returns the current Span's TraceID.
func MetadataFromContext ¶
MetadataFromContext Extracting contextual meta-information.
func StartSpanFromMetadata ¶
func StartSpanFromMetadata(ctx context.Context, spanName string, md metadata.Metadata, opts ...trace.SpanStartOption) context.Context
StartSpanFromMetadata creates a new context with incoming md attached. takes all values from the given ctx, without deadline and error control.
Types ¶
type Config ¶
type Config struct { Endpoint string Sampler float64 Batcher string Attributes []attribute.KeyValue }
A Config is a opentelemetry config.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithAttributes ¶
WithAttributes adds attributes to the configured Resource.
func WithBatcher ¶
func WithEndpoint ¶
func WithSampler ¶
type OptionFunc ¶
type OptionFunc func(*Config)
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
func NewTracer ¶
func NewTracer(kind trace.SpanKind, opts ...TracerOption) *Tracer
NewTracer create tracer instance
func (*Tracer) Extract ¶
func (t *Tracer) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context
Extract reads cross-cutting concerns from the carrier into a Context.
func (*Tracer) Inject ¶
func (t *Tracer) Inject(ctx context.Context, carrier propagation.TextMapCarrier)
Inject set cross-cutting concerns from the Context into the carrier.
type TracerOption ¶
type TracerOption func(*tracerOptions)
TracerOption is tracing option.
func WithPropagator ¶
func WithPropagator(propagator propagation.TextMapPropagator) TracerOption
WithPropagator with tracer propagator.
Click to show internal directories.
Click to hide internal directories.