tracing

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEventWithCodeLocation added in v1.0.19

func AddEventWithCodeLocation(span trace.Span, message string)

AddEventWithCodeLocation creates event in span with current code location

func AttachCodeLocationToSpan

func AttachCodeLocationToSpan(span trace.Span)

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 ConfigureUDP

func ConfigureUDP(cfg UDPConfig, extraAttributes ...attribute.KeyValue) (err error)

ConfigureUDP fine tunes jaeger exporter to deliver spans via compact thrift protocol to agent udp listener

func Start

func Start(cfg Config, extraAttributes ...attribute.KeyValue) (err error)

Start starts telemetry exporter

func Wait

func Wait(ctx context.Context) (err error)

Wait allows span exporter to inhibit application shutdown until it sends all traces

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"`

	// 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"`

	// 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"`
}

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"`
}

HTTPConfig is used to fine tune jaeger exporter to deliver spans via compact thrift protocol to collector http endpoint

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"`
}

UDPConfig is used to fine tune jaeger exporter to deliver spans via compact thrift protocol to agent udp listener

Jump to

Keyboard shortcuts

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