Documentation
¶
Index ¶
- func ContextWithSpan(ctx context.Context) context.Context
- func GetTracerProvider() *sdktrace.TracerProvider
- func Go(ctx context.Context, fn func())
- func GoWithContext(ctx context.Context, fn func(ctx context.Context))
- func Init(cfg TraceConfig) error
- func RunWithTrace(ctx context.Context, fn func(ctx context.Context))
- func Shutdown(ctx context.Context) error
- type BatchConfig
- type TraceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTracerProvider ¶
func GetTracerProvider() *sdktrace.TracerProvider
GetTracerProvider returns the current tracer provider
func GoWithContext ¶
GoWithContext .
func Init ¶
func Init(cfg TraceConfig) error
Init initializes OpenTelemetry tracing with the given configuration
func RunWithTrace ¶
RunWithTrace .
Types ¶
type BatchConfig ¶
type BatchConfig struct {
// MaxQueueSize is the maximum queue size
MaxQueueSize int `mapstructure:"maxQueueSize"`
// BatchTimeout is the timeout for batching spans
BatchTimeout time.Duration `mapstructure:"batchTimeout"`
// ExportTimeout is the timeout for exporting spans
ExportTimeout time.Duration `mapstructure:"exportTimeout"`
// MaxExportBatchSize is the maximum batch size for export
MaxExportBatchSize int `mapstructure:"maxExportBatchSize"`
}
BatchConfig configures the batch span processor
type TraceConfig ¶
type TraceConfig struct {
// Enabled enables or disables tracing
Enabled bool `mapstructure:"enabled"`
// ServiceName is the name of the service
ServiceName string `mapstructure:"serviceName"`
// ServiceVersion is the version of the service
ServiceVersion string `mapstructure:"serviceVersion"`
// ExporterType specifies the exporter type: "jaeger", "otlp-grpc", "otlp-http", or "none"
ExporterType string `mapstructure:"exporterType"`
// Endpoint is the endpoint URL for the exporter
// For Jaeger: http://localhost:14268/api/traces
// For OTLP gRPC: localhost:4317
// For OTLP HTTP: http://localhost:4318
Endpoint string `mapstructure:"endpoint"`
// Insecure allows insecure connections (for development)
Insecure bool `mapstructure:"insecure"`
// Headers are additional headers to send with the trace export
Headers map[string]string `mapstructure:"headers"`
// BatchConfig configures the batch span processor
BatchConfig BatchConfig `mapstructure:"batch"`
}
TraceConfig represents the configuration for OpenTelemetry tracing
func (*TraceConfig) SetDefaults ¶
func (c *TraceConfig) SetDefaults()
SetDefaults sets default values for the configuration
Click to show internal directories.
Click to hide internal directories.