Documentation ¶
Index ¶
- Constants
- func AddInstrumentorProvider(name string, provider InstrumentorProvider)
- func AddOtelTraceExporter(name string, exporter OtelExporterFactory)
- func AddTracerProvider(name string, provider TracerProvider)
- func ContextTraceFieldsResolver(ctx context.Context) map[string]any
- func ContextWithSpan(ctx context.Context, span Span) context.Context
- func ContextWithTrace(ctx context.Context, trace *Trace) context.Context
- func GetTraceIdFromContext(ctx context.Context) *string
- func NewAwsInstrumentorWithAppId(appId cfg.AppId) *awsInstrumentor
- func NewAwsTracerWithInterfaces(logger log.Logger, appId cfg.AppId, settings *XRaySettings) (*awsTracer, error)
- func NewOtelHttpTracer(ctx context.Context, config cfg.Config, _ log.Logger) (*otlptrace.Exporter, error)
- func NewOtelInstrumentorWithAppId(appId cfg.AppId) *otelInstrumentor
- func NewOtelTracerWithInterfaces(logger log.Logger, tracer trace.Tracer) *otelTracer
- func ProvideOtelTraceProvider(ctx context.Context, config cfg.Config, logger log.Logger) (trace.TracerProvider, error)
- func TraceToString(trace *Trace) string
- type ContextMissingWarnSamplingConfig
- type ContextMissingWarnStrategy
- type Instrumentor
- func NewAwsInstrumentor(_ context.Context, config cfg.Config, _ log.Logger) (Instrumentor, error)
- func NewLocalInstrumentor() Instrumentor
- func NewNoopInstrumentor() Instrumentor
- func NewOtelInstrumentor(ctx context.Context, config cfg.Config, logger log.Logger) (Instrumentor, error)
- func ProvideInstrumentor(ctx context.Context, config cfg.Config, logger log.Logger) (Instrumentor, error)
- type InstrumentorProvider
- type LoggerErrorHandler
- type MessageWithTraceEncoder
- type OtelExporterFactory
- type OtelExporterSettings
- type OtelSettings
- type RetryConfig
- type SampleRule
- type SamplingConfiguration
- type Span
- type SpanLimits
- type Trace
- type TraceAble
- type TraceIdErrorReturnStrategy
- type TraceIdErrorStrategy
- type TraceIdErrorWarningStrategy
- type Tracer
- func NewAwsTracer(_ context.Context, config cfg.Config, logger log.Logger) (Tracer, error)
- func NewLocalTracer() Tracer
- func NewNoopTracer() Tracer
- func NewOtelTracer(ctx context.Context, config cfg.Config, logger log.Logger) (Tracer, error)
- func ProvideTracer(ctx context.Context, config cfg.Config, logger log.Logger) (Tracer, error)
- type TracerProvider
- type TracerSettings
- type XRaySettings
- type XrayTracerSettings
Constants ¶
View Source
const ( ProviderNoop = "noop" ProviderLocal = "local" ProviderXray = "xray" ProviderOtel = "otel" )
Variables ¶
This section is empty.
Functions ¶
func AddInstrumentorProvider ¶ added in v0.30.0
func AddInstrumentorProvider(name string, provider InstrumentorProvider)
func AddOtelTraceExporter ¶ added in v0.30.0
func AddOtelTraceExporter(name string, exporter OtelExporterFactory)
func AddTracerProvider ¶ added in v0.30.0
func AddTracerProvider(name string, provider TracerProvider)
func GetTraceIdFromContext ¶ added in v0.29.0
func NewAwsInstrumentorWithAppId ¶ added in v0.30.0
func NewOtelHttpTracer ¶ added in v0.30.0
func NewOtelInstrumentorWithAppId ¶ added in v0.30.0
func NewOtelTracerWithInterfaces ¶ added in v0.30.0
func ProvideOtelTraceProvider ¶ added in v0.30.0
func TraceToString ¶
Types ¶
type ContextMissingWarnStrategy ¶
type ContextMissingWarnStrategy struct {
// contains filtered or unexported fields
}
func NewContextMissingWarningLogStrategy ¶
func NewContextMissingWarningLogStrategy(logger log.Logger) *ContextMissingWarnStrategy
func (ContextMissingWarnStrategy) ContextMissing ¶
func (c ContextMissingWarnStrategy) ContextMissing(v interface{})
type Instrumentor ¶ added in v0.30.0
type Instrumentor interface { HttpHandler(h http.Handler) http.Handler HttpClient(baseClient *http.Client) *http.Client GrpcUnaryServerInterceptor() grpc.UnaryServerInterceptor GrpcServerHandler() stats.Handler }
func NewAwsInstrumentor ¶ added in v0.30.0
func NewLocalInstrumentor ¶ added in v0.30.0
func NewLocalInstrumentor() Instrumentor
func NewNoopInstrumentor ¶ added in v0.30.0
func NewNoopInstrumentor() Instrumentor
func NewOtelInstrumentor ¶ added in v0.30.0
func ProvideInstrumentor ¶ added in v0.30.0
type InstrumentorProvider ¶ added in v0.30.0
type LoggerErrorHandler ¶
type LoggerErrorHandler struct{}
func NewLoggerErrorHandler ¶
func NewLoggerErrorHandler() *LoggerErrorHandler
func (*LoggerErrorHandler) Channels ¶
func (h *LoggerErrorHandler) Channels() []string
func (*LoggerErrorHandler) Level ¶
func (h *LoggerErrorHandler) Level() int
type MessageWithTraceEncoder ¶
type MessageWithTraceEncoder struct {
// contains filtered or unexported fields
}
func NewMessageWithTraceEncoder ¶
func NewMessageWithTraceEncoder(strategy TraceIdErrorStrategy) *MessageWithTraceEncoder
type OtelExporterFactory ¶ added in v0.30.0
type OtelExporterSettings ¶ added in v0.30.0
type OtelExporterSettings struct { Endpoint string `cfg:"endpoint" default:"localhost:4318"` UrlPath string `cfg:"url_path" default:"/v1/traces"` Compression bool `cfg:"compression" default:"true"` Insecure bool `cfg:"insecure" default:"false"` Timeout time.Duration `cfg:"timeout" default:"10s"` Retry RetryConfig `cfg:"retry"` }
type OtelSettings ¶ added in v0.30.0
type OtelSettings struct { Exporter string `cfg:"exporter" default:"otel_http"` SamplingRatio float64 `cfg:"sampling_ratio" default:"0.05"` SpanLimits }
type RetryConfig ¶ added in v0.30.0
type SampleRule ¶
type SampleRule struct { Description string `json:"description" cfg:"description" default:"default"` ServiceName string `json:"service_name" cfg:"service_name"` HttpMethod string `json:"http_method" cfg:"http_method"` UrlPath string `json:"url_path" cfg:"url_path"` FixedTarget uint64 `json:"fixed_target" cfg:"fixed_target" default:"1"` Rate float64 `json:"rate" cfg:"rate" default:"0.05"` }
type SamplingConfiguration ¶
type SamplingConfiguration struct { Version int `json:"version" cfg:"version" default:"1"` Default SampleRule `json:"default" cfg:"default"` Rules []SampleRule `json:"rules" cfg:"rules"` }
type Span ¶
type Span interface { AddAnnotation(key string, value string) AddError(err error) AddMetadata(key string, value interface{}) Finish() GetId() string GetTrace() *Trace }
func GetSpanFromContext ¶
type SpanLimits ¶ added in v0.30.0
type SpanLimits struct { AttributeValueLengthLimit int `cfg:"attribute_value_length_limit" default:"-1"` AttributeCountLimit int `cfg:"attribute_count_limit" default:"128"` EventCountLimit int `cfg:"event_count_limit" default:"128"` LinkCountLimit int `cfg:"link_count_limit" default:"128"` AttributePerEventCountLimit int `cfg:"attribute_per_event_count_limit" default:"128"` AttributePerLinkCountLimit int `cfg:"attribute_per_link_count_limit" default:"128"` }
type Trace ¶
type Trace struct { TraceId string `json:"traceId"` Id string `json:"id"` ParentId string `json:"parentId"` Sampled bool `json:"sampled"` }
func GetTraceFromContext ¶
func StringToTrace ¶
func (*Trace) GetParentId ¶
func (*Trace) GetSampled ¶
func (*Trace) GetTraceId ¶
type TraceIdErrorReturnStrategy ¶
type TraceIdErrorReturnStrategy struct{}
func (TraceIdErrorReturnStrategy) TraceIdInvalid ¶
func (t TraceIdErrorReturnStrategy) TraceIdInvalid(err error) error
type TraceIdErrorStrategy ¶
type TraceIdErrorWarningStrategy ¶
type TraceIdErrorWarningStrategy struct {
// contains filtered or unexported fields
}
func NewTraceIdErrorWarningStrategy ¶
func NewTraceIdErrorWarningStrategy(logger log.Logger) *TraceIdErrorWarningStrategy
func NewTraceIdErrorWarningStrategyWithInterfaces ¶
func NewTraceIdErrorWarningStrategyWithInterfaces(logger log.Logger, stacktraceProvider log.StackTraceProvider) *TraceIdErrorWarningStrategy
func (TraceIdErrorWarningStrategy) TraceIdInvalid ¶
func (t TraceIdErrorWarningStrategy) TraceIdInvalid(err error) error
type Tracer ¶
type Tracer interface { StartSpan(name string) (context.Context, Span) StartSpanFromContext(ctx context.Context, name string) (context.Context, Span) StartSubSpan(ctx context.Context, name string) (context.Context, Span) }
func NewAwsTracer ¶
func NewLocalTracer ¶ added in v0.26.6
func NewLocalTracer() Tracer
func NewNoopTracer ¶
func NewNoopTracer() Tracer
func NewOtelTracer ¶ added in v0.30.0
type TracerProvider ¶ added in v0.30.0
type TracerSettings ¶
type TracerSettings struct {
Provider string `cfg:"provider" default:"local" validate:"required"`
}
type XRaySettings ¶
type XrayTracerSettings ¶ added in v0.30.0
type XrayTracerSettings struct { AddressType string `cfg:"addr_type" default:"local" validate:"required"` AddressValue string `cfg:"add_value" default:""` Sampling SamplingConfiguration `cfg:"sampling"` StreamingMaxSubsegmentCount int `cfg:"streaming_max_subsegment_count" default:"20"` }
Source Files ¶
- aws.go
- constants.go
- context_missing.go
- context_span.go
- context_trace.go
- instrumentor.go
- instrumentor_aws.go
- instrumentor_local.go
- instrumentor_noop.go
- instrumentor_otel.go
- logging.go
- message_encode_handler.go
- otel_exporters.go
- otel_trace_provider.go
- provider.go
- sampling.go
- span.go
- span_otel.go
- span_root.go
- trace_able.go
- trace_id_invalid_strategy.go
- tracer.go
- tracer_aws.go
- tracer_local.go
- tracer_noop.go
- tracer_otel.go
Click to show internal directories.
Click to hide internal directories.