package lightstepoc

import "github.com/lightstep/lightstep-tracer-go/lightstepoc"

Package lightstepoc provides an OpenCensus exporter for sending OpenCensus spans back to LightStep.

NOTE: This package is currently experimental. Breaking changes may occur, independent of version.

func Example() {
    exporterOptions := []lightstepoc.Option{}
    exporter, err := lightstepoc.NewExporter(exporterOptions...)}
    if err != nil {
        log.Fatal(err)
    }
    defer exporter.Close(context.Background())

    trace.RegisterExporter(nil)
}

Index

Constants

const (
	DefaultSatelliteHost = "localhost"
	DefaultSatellitePort = 8360
)

By default, the exporter will attempt to connect to a local satellite

Variables

var (
	// ErrFailedToCreateExporter indicates that the underlying tracer could not be created,
	// but the root reason is not known.
	ErrFailedToCreateExporter = errors.New("lightstepoc: failed to create exporter")
)

Types

type Exporter

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

Exporter may be registered with OpenCensus so that span data can be exported to LightStep

func NewExporter

func NewExporter(opts ...Option) (*Exporter, error)

NewExporter creates a new Exporter. It returns an error if the underlying tracer could not be created, e.g., due to invalid options

func (*Exporter) Close

func (e *Exporter) Close(ctx context.Context)

Close flushes all buffered spans and then kills open connections to LightStep, releasing resources

func (*Exporter) ExportSpan

func (e *Exporter) ExportSpan(sd *trace.SpanData)

ExportSpan queues the span to be sent LightStep. Spans are typically batched for performance reasons. Call `Exporter#Flush` to send all queued spans.

func (*Exporter) Flush

func (e *Exporter) Flush(ctx context.Context)

Flush sends all buffered spans to LightStep

type Option

type Option func(*config)

Option provides configuration for the Exporter

func WithAccessToken

func WithAccessToken(accessToken string) Option

WithAccessToken sets an access token for communicating with LightStep

func WithComponentName

func WithComponentName(componentName string) Option

WithComponentName overrides the component (service) name that will be used in LightStep

func WithInsecure

func WithInsecure(insecure bool) Option

WithInsecure prevents the Exporter from communicating over TLS with the satellite, i.e., the connection will run over HTTP instead of HTTPS

func WithMetaEventReportingEnabled

func WithMetaEventReportingEnabled(metaEventReportingEnabled bool) Option

WithMetaEventReportingEnabled configures the tracer to send meta events, e.g., events for span creation

func WithSatelliteHost

func WithSatelliteHost(satelliteHost string) Option

WithSatelliteHost sets the satellite host to which spans will be sent

func WithSatellitePort

func WithSatellitePort(satellitePort int) Option

WithSatellitePort sets the satellite port to which spans will be sent

Source Files

exporter.go options.go package.go

Directories

PathSynopsis
lightstepoc/internal
Version
v0.16.0
Published
May 2, 2019
Platform
darwin/amd64
Imports
8 packages
Last checked
3 hours ago

Tools for package owners.