traces

package
v0.87.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureTracing

func ConfigureTracing(processName string) (func(), error)

ConfigureTracing configures the OpenTelemetry trace provider for CLI commands. Projects using troubleshoot as a library would need to register troubleshoot's exporter like so.

var tp *trace.TracerProvider	// client application's trace provider
tp.RegisterSpanProcessor(
	trace.NewSimpleSpanProcessor(
		traces.GetExporterInstance(),	// Troubleshoot's exporter
	),
)

The client application is responsible for constructing the trace provider and registering the exporter. Multiple exporters can be registered.

Types

type Exporter

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

Exporter is an implementation of trace.SpanExporter that writes to a destination.

func GetExporterInstance

func GetExporterInstance() *Exporter

GetExporterInstance creates a singleton exporter instance

func (*Exporter) ExportSpans

func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error

ExportSpans writes spans to an in-memory cache This function can/will be called on every span.End() at worst.

func (*Exporter) GetSummary

func (e *Exporter) GetSummary() string

GetSummary returns the runtime summary of the execution so far. Call this function after your "root" span has ended and the program operations needing tracing have completed.

func (*Exporter) MarshalLog

func (e *Exporter) MarshalLog() interface{}

MarshalLog is the marshaling function used by the logging system to represent this exporter.

func (*Exporter) Reset

func (e *Exporter) Reset()

func (*Exporter) Shutdown

func (e *Exporter) Shutdown(ctx context.Context) error

Shutdown is called to stop the exporter, it preforms no action.

Jump to

Keyboard shortcuts

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