otelx

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigSchemaID = "ory://tracing-config"

Variables

View Source
var ConfigSchema string

Functions

func AddConfigSchema

func AddConfigSchema(c interface {
	AddResource(url string, r io.Reader) error
}) error

AddConfigSchema adds the tracing schema to the compiler. The interface is specified instead of `jsonschema.Compiler` to allow the use of any jsonschema library fork or version.

func NewHandler

func NewHandler(handler http.Handler, operation string) http.Handler

NewHandler returns a wrapped otelhttp.NewHandler with our request filters.

func SetupJaeger

func SetupJaeger(t *Tracer, tracerName string) (trace.Tracer, error)

Optionally, Config.Providers.Jaeger.LocalAgentAddress can be set. NOTE: If Config.Providers.Jaeger.Sampling.ServerURL is not specfied, AlwaysSample is used.

func SetupOTLP

func SetupOTLP(t *Tracer, tracerName string) (trace.Tracer, error)

func SetupZipkin

func SetupZipkin(t *Tracer, tracerName string) (trace.Tracer, error)

func StringAttrs

func StringAttrs(attrs map[string]string) []attribute.KeyValue

func TraceHandler

func TraceHandler(h http.Handler) http.Handler

TraceHandler wraps otelx.NewHandler, passing the URL path as the span name.

Types

type Config

type Config struct {
	ServiceName string          `json:"service_name"`
	Provider    string          `json:"provider"`
	Providers   ProvidersConfig `json:"providers"`
}

type JaegerConfig

type JaegerConfig struct {
	LocalAgentAddress string         `json:"local_agent_address"`
	Sampling          JaegerSampling `json:"sampling"`
}

type JaegerSampling

type JaegerSampling struct {
	ServerURL string `json:"server_url"`
}

type OTLPConfig

type OTLPConfig struct {
	ServerURL string       `json:"server_url"`
	Insecure  bool         `json:"insecure"`
	Sampling  OTLPSampling `json:"sampling"`
}

type OTLPSampling

type OTLPSampling struct {
	SamplingRatio float64 `json:"sampling_ratio"`
}

type ProvidersConfig

type ProvidersConfig struct {
	Jaeger JaegerConfig `json:"jaeger"`
	Zipkin ZipkinConfig `json:"zipkin"`
	OTLP   OTLPConfig   `json:"otlp"`
}

type Tracer

type Tracer struct {
	Config *Config
	// contains filtered or unexported fields
}

func New

func New(name string, l *logrusx.Logger, c *Config) (*Tracer, error)

Creates a new tracer. If name is empty, a default tracer name is used instead. See: https://godocs.io/go.opentelemetry.io/otel/sdk/trace#TracerProvider.Tracer

func NewNoop

func NewNoop(l *logrusx.Logger, c *Config) *Tracer

Creates a new no-op tracer.

func (*Tracer) IsLoaded

func (t *Tracer) IsLoaded() bool

IsLoaded returns true if the tracer has been loaded.

func (*Tracer) Tracer

func (t *Tracer) Tracer() trace.Tracer

Returns the wrapped tracer.

type ZipkinConfig

type ZipkinConfig struct {
	ServerURL string         `json:"server_url"`
	Sampling  ZipkinSampling `json:"sampling"`
}

type ZipkinSampling

type ZipkinSampling struct {
	SamplingRatio float64 `json:"sampling_ratio"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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