Documentation ¶
Overview ¶
Copyright 2024 Azugo SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func FromContext(ctx context.Context) context.Context
- func Use(app *azugo.App, config *Configuration, opts ...Option) (core.Tasker, error)
- func Version() string
- type Configuration
- type Filter
- type InstrumentationRecorderFunc
- type InstrumentationSpanNameFormatter
- type Option
- type PublicEndpoint
- type PublicEndpointFilter
- type RouteSpanNameFormatter
Constants ¶
const (
// ScopeName is the instrumentation scope name.
ScopeName = "azugo.io/opentelemetry"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct { Disabled bool `mapstructure:"disabled"` Endpoint string `mapstructure:"endpoint"` InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"` ServiceName string `mapstructure:"service_name"` ElasticAPMSecretToken string `mapstructure:"elastic_apm_secret_token"` }
Configuration section for OpenTracing.
func (*Configuration) Bind ¶
func (c *Configuration) Bind(prefix string, v *viper.Viper)
Bind OpenTracing configuration section.
func (*Configuration) IsDisabled ¶
func (c *Configuration) IsDisabled() bool
IsDisabled returns true if the tracing is disabled.
func (*Configuration) Validate ¶
func (c *Configuration) Validate(valid *validation.Validate) error
Validate OpenTracing configuration section.
type Filter ¶
Filter is a predicate used to determine whether a given HTTP request should be traced. A Filter must return true if the request should be traced.
Multiple filters can be proviaded and are applied in the order they are added. If no filters are provided then all requests are traced. Filters will be invoked for each processed request, it is advised to make them simple and fast.
type InstrumentationRecorderFunc ¶
type InstrumentationRecorderFunc func(ctx context.Context, tracer oteltrace.Tracer, propagator propagation.TextMapPropagator, spfmt InstrumentationSpanNameFormatter, op string, args ...any) (func(err error), bool)
InstrumentationRecorderFunc specifies a function to use for handling instrumentation events. The function should return a function that can be used to finish the span and a boolean indicating if specific instrumentation has been recorded.
type InstrumentationSpanNameFormatter ¶
type InstrumentationSpanNameFormatter func(ctx context.Context, op string, args ...interface{}) string
InstrumentationSpanNameFormatter specifies a function to use for generating a custom span name. By default, the span name is formatted based on the operation type and the arguments. If the provided function returns an empty string, the default span name will be used.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option specifies instrumentation configuration options.
func InstrumentationRecorder ¶
func InstrumentationRecorder(name string, recorder InstrumentationRecorderFunc, ops ...string) Option
InstrumentationRecorder specifies a function to use for handling instrumentation events for specific instrumentation operations. Multiple recorders can be provided and are applied in the order they are added.
func TextMapPropagator ¶
func TextMapPropagator(propagators propagation.TextMapPropagator) Option
TextMapPropagator specifies propagators to use for extracting information from the HTTP requests. If none are specified, global ones will be used.
func TracerProvider ¶
func TracerProvider(provider oteltrace.TracerProvider) Option
TracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.
type PublicEndpoint ¶
type PublicEndpoint bool
PublicEndpoint configures the Handler to link the span with an incoming span context. If this option is not provided, then the association is a child association instead of a link.
type PublicEndpointFilter ¶
PublicEndpointFilter runs with every request, and allows conditionnally configuring the Handler to link the span with an incoming span context. If this option is not provided or returns false, then the association is a child association instead of a link. Note: PublicEndpoint takes precedence over PublicEndpointFilter.
type RouteSpanNameFormatter ¶
RouteSpanNameFormatter specifies a function to use for generating a custom span name. By default, the route name (path template or regexp) is used. The route name is provided so you can use it in the span name without needing to duplicate the logic for extracting it from the request.