tracing

package
v0.0.0-...-37bd758 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 19 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyServerRootCaPool = errors.New("empty server root ca cert pool")

ErrEmptyServerRootCaPool indicates that cert pool is empty and does not have any certificates inside.

View Source
var Propagator propagation.TextMapPropagator = &propagator{}

Propagator is propagation.TextMapPropagator instance, used to extract/inject trace info from/to remote context.

Functions

func Setup

func Setup(ctx context.Context, cfg Config) (bool, error)

Setup initializes global tracer. Returns true if global tracer was updated. Shutdown method must be called for graceful shutdown.

func Shutdown

func Shutdown(ctx context.Context) error

Shutdown shutdowns tracing.

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartSpanFromContext creates a span and a context.Context containing the newly-created span.

Types

type Config

type Config struct {
	// Enabled is true, if tracing enabled.
	Enabled bool
	// Exporter is collector type.
	Exporter Exporter
	// Endpoint is collector endpoint for OTLP exporters.
	Endpoint string
	// ServerCaCertPool is cert pool of the remote server CA certificate. Use for TLS setup.
	ServerCaCertPool *x509.CertPool

	// Service is service name that will be used in tracing.
	// Mandatory.
	Service string
	// InstanceID is identity of service instance.
	// Optional.
	InstanceID string
	// Version is version of service instance.
	// Optional.
	Version string
	// Attributes is KV list of attributes.
	// Optional.
	Attributes map[string]string
}

type Exporter

type Exporter string

Exporter is type of tracing target.

const (
	StdoutExporter   Exporter = "stdout"
	OTLPgRPCExporter Exporter = "otlp_grpc"
	NoOpExporter     Exporter = "noop"
)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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