Documentation

Overview

    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.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    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.

      Types

      type Option

      type Option func(*config)

        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.

                    Directories

                    Path Synopsis
                    example module