trace

package
v2.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Disabled represents disabled exporter type
	Disabled = "none"
	// GRPC enables gRPC tracing
	GRPC = "grpc"
	// HTTP enables HTTP tracing
	HTTP = "http"
)

Trace type strings

Variables

View Source
var Noop = newNoopTracer()

Noop is a no-op tracer instance

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled controls whether tracing is enabled
	Enabled bool `json:"enabled"`

	// TracingEndpoint is the endpoint for the tracing collector
	TracingEndpoint string `json:"endpoint"`

	// TracingInsecure controls whether to use insecure connection
	TracingInsecure bool `json:"insecure"`

	// TracingSampleRate controls the sampling rate (0.0 to 1.0)
	TracingSampleRate float64 `json:"sampleRate"`

	// TraceSampleRate is an alias for TracingSampleRate
	TraceSampleRate float64 `json:"traceSampleRate"`

	// TracingExporter specifies the exporter type (e.g., "otlp", "jaeger")
	TracingExporter string `json:"exporter"`

	// ExporterConfig contains exporter-specific configuration
	ExporterConfig ExporterConfig `json:"exporterConfig"`

	// ServiceName is the name of the service for tracing
	ServiceName string `json:"serviceName"`

	// ServiceVersion is the version of the service
	ServiceVersion string `json:"serviceVersion"`

	// AppName is an alias for ServiceName
	AppName string `json:"appName"`

	// Version is an alias for ServiceVersion
	Version string `json:"version"`

	// BufferSize is the size of the span buffer
	BufferSize int `json:"bufferSize"`

	// ExportTimeout is the timeout for exporting spans
	ExportTimeout time.Duration `json:"exportTimeout"`
}

Config contains configuration for distributed tracing

type ExporterConfig

type ExporterConfig struct {
	// Type is the type of exporter
	Type ExporterType `json:"type"`

	// Endpoint is the endpoint for the exporter
	Endpoint string `json:"endpoint"`

	// Insecure controls whether to use insecure connection
	Insecure bool `json:"insecure"`

	// Headers are additional headers to send
	Headers map[string]string `json:"headers"`

	// OTLP exporter configuration
	OTLPEndpoint string            `json:"otlpEndpoint"`
	OTLPHeaders  map[string]string `json:"otlpHeaders"`

	// Jaeger exporter configuration
	JaegerEndpoint string `json:"jaegerEndpoint"`

	// Zipkin exporter configuration
	ZipkinEndpoint string `json:"zipkinEndpoint"`
}

ExporterConfig contains exporter-specific configuration

type ExporterType

type ExporterType int

ExporterType represents the type of exporter

const (
	// NoneExporter represents no exporter
	NoneExporter ExporterType = iota
	// OTLPExporter represents OTLP exporter
	OTLPExporter
	// JaegerExporter represents Jaeger exporter
	JaegerExporter
	// ZipkinExporter represents Zipkin exporter
	ZipkinExporter
)

func ExporterTypeFromString

func ExporterTypeFromString(s string) (ExporterType, error)

ExporterTypeFromString converts a string to ExporterType

type Tracer

type Tracer interface {
	trace.Tracer
	io.Closer
}

Tracer is the interface for tracing

func New

func New(cfg Config) (Tracer, error)

New creates a new tracer based on the configuration

Jump to

Keyboard shortcuts

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