opentelemetry

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 14

README

OpenTelemetry wrappers

OpenTelemetry wrappers propagate traces (spans) accross services.

Usage

service := micro.NewService(
    micro.Name("go.micro.srv.greeter"),
    micro.WrapClient(opentelemetry.NewClientWrapper()),
    micro.WrapHandler(open.NewHandlerWrapper()),
    micro.WrapSubscriber(opentelemetry.NewSubscriberWrapper()),
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCallWrapper

func NewCallWrapper(opts ...Option) client.CallWrapper

NewCallWrapper accepts an opentracing Tracer and returns a Call Wrapper.

func NewClientWrapper

func NewClientWrapper(opts ...Option) client.Wrapper

NewClientWrapper returns a client.Wrapper that adds monitoring to outgoing requests.

func NewHandlerWrapper

func NewHandlerWrapper(opts ...Option) server.HandlerWrapper

NewHandlerWrapper accepts an opentracing Tracer and returns a Handler Wrapper.

func NewSubscriberWrapper

func NewSubscriberWrapper(opts ...Option) server.SubscriberWrapper

NewSubscriberWrapper accepts an opentracing Tracer and returns a Subscriber Wrapper.

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, tp trace.TracerProvider, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartSpanFromContext returns a new span with the given operation name and options. If a span is found in the context, it will be used as the parent of the resulting span.

Types

type CallFilter added in v1.1.1

type CallFilter func(context.Context, client.Request) bool

CallFilter used to filter client.Call, return true to skip call trace.

type HandlerFilter added in v1.1.1

type HandlerFilter func(context.Context, server.Request) bool

HandlerFilter used to filter server.Handle, return true to skip handle trace.

type Option added in v1.1.1

type Option func(*Options)

func WithCallFilter added in v1.1.1

func WithCallFilter(filter CallFilter) Option

func WithHandleFilter added in v1.1.1

func WithHandleFilter(filter HandlerFilter) Option

func WithPublishFilter added in v1.1.1

func WithPublishFilter(filter PublishFilter) Option

func WithStreamFilter added in v1.1.1

func WithStreamFilter(filter StreamFilter) Option

func WithSubscribeFilter added in v1.1.1

func WithSubscribeFilter(filter SubscriberFilter) Option

func WithTraceProvider added in v1.1.1

func WithTraceProvider(tp trace.TracerProvider) Option

type Options added in v1.1.1

type Options struct {
	TraceProvider trace.TracerProvider

	CallFilter       CallFilter
	StreamFilter     StreamFilter
	PublishFilter    PublishFilter
	SubscriberFilter SubscriberFilter
	HandlerFilter    HandlerFilter
}

type PublishFilter added in v1.1.1

type PublishFilter func(context.Context, client.Message) bool

PublishFilter used to filter client.Publish, return true to skip publish trace.

type StreamFilter added in v1.1.1

type StreamFilter func(context.Context, client.Request) bool

StreamFilter used to filter client.Stream, return true to skip stream trace.

type SubscriberFilter added in v1.1.1

type SubscriberFilter func(context.Context, server.Message) bool

SubscriberFilter used to filter server.Subscribe, return true to skip subcribe trace.

Jump to

Keyboard shortcuts

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