distro

package
Version: v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package distro provides functionality to quickly setup the OpenTelemetry Go implementation with useful Splunk defaults.

The default configuration sets the default OpenTelemetry SDK to propagate traces using B3 propagator and export all spans to a locally running Splunk OpenTelemetry Connector (http://localhost:14268/api/traces).

Example
package main

import (
	"context"

	"github.com/signalfx/splunk-otel-go/distro"
)

func main() {
	// By default, the Run function creates a Jaeger Thrift over HTTP exporter
	// to http://localhost:14268/api/traces and configures the B3 context
	// 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

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option sets a config setting value.

func WithAccessToken added in v0.3.0

func WithAccessToken(accessToken string) Option

WithAccessToken configures the authentication token allowing exporters to send data directly to a Splunk back-end. Setting empty string results in no operation.

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint configures the endpoint telemetry is sent to. Setting empty string results in no operation.

type SDK

type SDK struct {
	// contains filtered or unexported fields
}

SDK contains all OpenTelemetry SDK state and provides access to this state.

func Run

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

Run configures the default OpenTelemetry SDK and installs it globally.

func (SDK) Shutdown

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

Shutdown stops the SDK and releases any used resources.

Source Files

Jump to

Keyboard shortcuts

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