package module
Version: v1.6.0 Latest Latest

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 25 Imported by: 2


Package github.com/signalfx/splunk-otel-go/distro

Go Reference

Run is the main entry point for this package. Use it to create an SDK ready to be used with OpenTelemetry and forward all telemetry to Splunk Observabilty Cloud.

See our example applications.

Read the official documentation for this distribution in the Splunk Docs site.



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.

package main

import (


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 {
	// To ensure all spans are flushed before the application exits, make sure
	// to shutdown.
	defer func() {
		if err := sdk.Shutdown(context.Background()); err != nil {




This section is empty.


This section is empty.


func Version added in v1.6.0

func Version() string

Version returns the version of distro.


type Option

type Option interface {
	// contains filtered or unexported methods

Option sets a config setting value.

func WithLogger

func WithLogger(l logr.Logger) Option

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

func WithTLSConfig(conf *tls.Config) Option

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.

func Run

func Run(opts ...Option) (SDK, error)

Run configures the default OpenTelemetry SDK and installs it globally.

It is the callers responsibility to shut down the returned SDK when complete. This ensures all resources are released and all telemetry flushed.

func (SDK) Shutdown

func (s SDK) Shutdown(ctx context.Context) error

Shutdown stops the SDK and releases any used resources.

Jump to

Keyboard shortcuts

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