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
- Variables
- type Attributes
- type Exporter
- func NewExporter(opts ...Option) (*Exporter, error)
- func (e *Exporter) Close(ctx context.Context)
- func (e *Exporter) ExportSpan(sd *trace.SpanData)
- func (e *Exporter) Flush(ctx context.Context)
- type Option
- func WithAccessToken(accessToken string) Option
- func WithComponentName(componentName string) Option
- func WithDefaultAttributes(attrs Attributes) Option
- func WithInsecure(insecure bool) Option
- func WithMaxBufferedSpans(value int) Option
- func WithMetaEventReportingEnabled(metaEventReportingEnabled bool) Option
- func WithSatelliteHost(satelliteHost string) Option
- func WithSatellitePort(satellitePort int) Option
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 Attributes ¶
type Attributes map[string]interface{}
Attributes provide extra information in a span
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 ¶
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 ¶
Close flushes all buffered spans and then kills open connections to LightStep, releasing resources
func (*Exporter) ExportSpan ¶
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 ¶
Flush sends all buffered spans to LightStep
type Option ¶
type Option func(*config)
Option provides configuration for the Exporter
func WithAccessToken ¶
WithAccessToken sets an access token for communicating with LightStep
func WithComponentName ¶
WithComponentName overrides the component (service) name that will be used in LightStep
func WithDefaultAttributes ¶
func WithDefaultAttributes(attrs Attributes) Option
WithDefaultAttributes sets attributes that will be appended to every span that is exported to the trace.
func WithInsecure ¶
WithInsecure prevents the Exporter from communicating over TLS with the satellite, i.e., the connection will run over HTTP instead of HTTPS
func WithMaxBufferedSpans ¶
WithMaxBufferedSpans sets the maximum number of spans that will be buffered before sending them to a collector. Should be used to override the `DefaultMaxSpan` value of 1000.
func WithMetaEventReportingEnabled ¶
WithMetaEventReportingEnabled configures the tracer to send meta events, e.g., events for span creation
func WithSatelliteHost ¶
WithSatelliteHost sets the satellite host to which spans will be sent
func WithSatellitePort ¶
WithSatellitePort sets the satellite port to which spans will be sent
Source Files ¶
exporter.go options.go package.go
Directories ¶
Path | Synopsis |
---|---|
lightstepoc/internal |
- Version
- v0.26.0 (latest)
- Published
- Aug 4, 2022
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 1 week ago –
Tools for package owners.