Documentation
¶
Index ¶
- func AddAttributeToSpan(span trace.Span, name string, val any)
- func AddEventWithCodeLocation(span trace.Span, message string)
- func AttachCodeLocationToSpan(span trace.Span)
- func ConfigureHTTP(cfg HTTPConfig, extraAttributes ...attribute.KeyValue) (err error)
- func ConfigureOTLPoverHTTP(ctx context.Context, cfg OTLPoverHTTPConfig, ...) (err error)
- func ConfigureUDP(cfg UDPConfig, extraAttributes ...attribute.KeyValue) (err error)
- func Shutdown(ctx context.Context) (err error)
- func Start(cfg Config, extraAttributes ...attribute.KeyValue) (err error)
- func StartWithContext(ctx context.Context, cfg Config, extraAttributes ...attribute.KeyValue) (err error)
- func Wait(ctx context.Context) (err error)
- type Config
- type HTTPConfig
- type OTLPoverHTTPConfig
- type UDPConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAttributeToSpan ¶ added in v1.4.0
AddAttributeToSpan attach any supportable value to span
func AddEventWithCodeLocation ¶ added in v1.0.19
AddEventWithCodeLocation creates event in span with current code location
func AttachCodeLocationToSpan ¶
AttachCodeLocationToSpan attach current code location to span
func ConfigureHTTP ¶
func ConfigureHTTP(cfg HTTPConfig, extraAttributes ...attribute.KeyValue) (err error)
ConfigureHTTP fine tunes jaeger exporter to deliver spans via compact thrift protocol to collector http endpoint
func ConfigureOTLPoverHTTP ¶ added in v1.0.27
func ConfigureOTLPoverHTTP(ctx context.Context, cfg OTLPoverHTTPConfig, extraAttributes ...attribute.KeyValue) (err error)
ConfigureOTLPoverHTTP fine tunes OTLP HTTP exporter to deliver spans via OTLP over HTTP protocol to collector http endpoint
func ConfigureUDP ¶
ConfigureUDP fine tunes jaeger exporter to deliver spans via compact thrift protocol to agent udp listener
Types ¶
type Config ¶
type Config struct {
// Protocol sets how we send spans to jaeger - over udp or over http
Protocol string `yaml:"protocol" validate:"required,oneof=udp http UDP HTTP otlp_http OTLP_HTTP"`
// Host - sets hostname of Jaeger agent, overrides environment value of OTEL_EXPORTER_JAEGER_AGENT_HOST.
// Default value is `localhost`
Host string `yaml:"host"`
// Port - sets port where Jaeger agent listens, overrides environment value of OTEL_EXPORTER_JAEGER_AGENT_PORT.
// Default value is `6831`
Port string `yaml:"port"`
// Endpoint is the URL for the Jaeger collector that spans are sent to,
// overrides value of environment variable OTEL_EXPORTER_JAEGER_ENDPOINT.
// Default value is `http://localhost:14268/api/traces`
Endpoint string `yaml:"endpoint"`
// Username used for basic authorization to access Jaeger collector. Setting value overrides environment
// variable OTEL_EXPORTER_JAEGER_USER. Default is empty
Username string `yaml:"username"`
// Password used for basic authorization to access Jaeger collector. Setting value overrides environment
// variable OTEL_EXPORTER_JAEGER_PASSWORD. Default is empty
Password string `yaml:"password"`
// OTLPEndpoint sets HTTP OTLP collector url, overrides value of environment variable of OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
// Default is "https://localhost:4318/v1/traces". See full documentation for environment options supported:
// https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp#pkg-overview
OTLPEndpoint string `yaml:"otlp_endpoint"`
// Insecure allows insecure connections over HTTP protocol where connection via HTTPS are preferred
Insecure bool `yaml:"insecure"`
// Ratio sets percent of spans to record, where 1 - means every span is recorded, 0 - no spans recorded and .05 means only 5% of spans are recorded
Ratio float64 `yaml:"ratio" validate:"required,lte=1,gte=0"`
/*
Extra trace provider options like samplers and so on applied for all exporters
*/
// TraceProviderOptions allows to add extra tracer provider options like custom sampler and so on
TraceProviderOptions []tracesdk.TracerProviderOption `yaml:"-"`
}
Config is universal config being used to tune tracing
type HTTPConfig ¶
type HTTPConfig struct {
Endpoint string `yaml:"endpoint"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Ratio float64 `yaml:"ratio" validate:"lte=1,gte=0"`
// TraceProviderOptions allows to add extra tracer provider options like custom sampler and so on
TraceProviderOptions []tracesdk.TracerProviderOption `yaml:"-"`
}
HTTPConfig is used to fine tune jaeger exporter to deliver spans via compact thrift protocol to collector http endpoint
type OTLPoverHTTPConfig ¶ added in v1.0.27
type OTLPoverHTTPConfig struct {
Endpoint string `yaml:"endpoint"`
Compression bool `yaml:"compression"`
Ratio float64 `yaml:"ratio" validate:"lte=1,gte=0"`
Headers map[string]string `yaml:"headers"`
Opts []otlptracehttp.Option `yaml:"-"`
Insecure bool `yaml:"insecure"`
TraceProviderOptions []tracesdk.TracerProviderOption `yaml:"-"`
}
OTLPoverHTTPConfig is used to fine http otlp exporter to deliver spans via OTLP over HTTP protocol
type UDPConfig ¶
type UDPConfig struct {
// Host - sets hostname of Jaeger agent, overrides environment value of OTEL_EXPORTER_JAEGER_AGENT_HOST.
// Default value is `localhost`
Host string `yaml:"host"`
// Port - sets port where Jaeger agent listens, overrides environment value of OTEL_EXPORTER_JAEGER_AGENT_PORT.
// Default value is `6831`
Port string `yaml:"port"`
// Ratio sets percent of spans to record, where 1 - means every span is recorded, 0 - no spans recorded and .05 means only 5% of spans are recorded
Ratio float64 `yaml:"ratio" validate:"required,lte=1,gte=0"`
// TraceProviderOptions allows to add extra tracer provider options like custom sampler and so on
TraceProviderOptions []tracesdk.TracerProviderOption `yaml:"-"`
}
UDPConfig is used to fine tune jaeger exporter to deliver spans via compact thrift protocol to agent udp listener