Documentation ¶
Overview ¶
Package distro provides functionality to quickly setup the OpenTelemetry Go SDK with useful Splunk defaults.
The default configuration sets the default OpenTelemetry SDK to propagate traces using a W3C tracecontext and W3C baggage propagator and export all spans and metrics to a locally running Splunk OpenTelemetry Collector.
Example ¶
package main import ( "context" "github.com/unionai/splunk-otel-go/distro" ) func main() { // By default, the Run function creates a OTLP gRPC exporter and // configures the W3C tracecontext and W3C baggage propagation format to // be used in extracting and injecting trace context. sdk, err := distro.Run() if err != nil { panic(err) } // To ensure all spans are flushed before the application exits, make sure // to shutdown. defer func() { if err := sdk.Shutdown(context.Background()); err != nil { panic(err) } }() }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option sets a config setting value.
func WithIDGenerator ¶
func WithIDGenerator(g trace.IDGenerator) Option
WithIDGenerator configures the generator used to generate span and trace IDs. If this option is not provided, the SDK's default ID generator will be used.
func WithLogger ¶
WithLogger configures the logger used by this distro.
The logr.Logger provided should be configured with a verbosity enabled to emit Info logs of the desired level. The following log level to verbosity value are used.
- warning: 0
- info: 1
- debug: 2+
By default, a zapr.Logger configured for info logging will be used if this is not provided.
func WithTLSConfig ¶
WithTLSConfig configures the TLS configuration used by the exporter.
If this option is not provided, the exporter connection will use the default TLS config.
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK is the Splunk distribution of the OpenTelemetry SDK.