package module
Version: v0.42.0 Latest Latest

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 7 Imported by: 2



Package otelkit instruments the github.com/go-kit/kit package.

Compared to other instrumentation libraries provided by go-kit itself, this package only provides instrumentation for the endpoint layer. For instrumenting the transport layer, look at the instrumentation libraries provided by go.opentelemetry.io/contrib. Learn more about go-kit's layers at https://gokit.io/faq/#architecture-and-design.



This section is empty.


This section is empty.


func EndpointMiddleware

func EndpointMiddleware(options ...Option) endpoint.Middleware

EndpointMiddleware returns an Endpoint middleware, tracing a Go kit endpoint. This endpoint middleware should be used in combination with a Go kit Transport tracing middleware, generic OpenTelemetry transport middleware or custom before and after transport functions.

func SemVersion deprecated added in v0.24.0

func SemVersion() string

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

Deprecated: Use Version instead.

func Version added in v0.24.0

func Version() string

Version is the current release version of the go-kit instrumentation.


type Option

type Option interface {
	// contains filtered or unexported methods

Option configures an EndpointMiddleware.

func WithAttributeGetter

func WithAttributeGetter(fn func(ctx context.Context) []attribute.KeyValue) Option

WithAttributeGetter extracts additional attributes from the context.

func WithAttributes

func WithAttributes(attrs ...attribute.KeyValue) Option

WithAttributes sets the default attributes for the spans created by the Endpoint tracer.

func WithIgnoreBusinessError

func WithIgnoreBusinessError(val bool) Option

WithIgnoreBusinessError if set to true will not treat a business error identified through the endpoint.Failer interface as a span error.

func WithOperation

func WithOperation(operation string) Option

WithOperation sets an operation name for an endpoint. Use this when you register a middleware for each endpoint.

func WithOperationGetter

func WithOperationGetter(fn func(ctx context.Context, name string) string) Option

WithOperationGetter sets an operation name getter function in config.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

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


Path Synopsis
example module
test module

Jump to

Keyboard shortcuts

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