export

package
v0.453.0 Latest Latest
Warning

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

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

Documentation

Overview

Package export holds the definition of the telemetry Exporter interface, along with some simple implementations. Larger more complex exporters are in sub packages of their own.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextSpan

func ContextSpan(ctx context.Context, event telemetry.Event) context.Context

ContextSpan is an exporter that maintains hierarchical span structure in the context. It creates new spans on EventStartSpan, adds events to the current span on EventLog or EventTag, and closes the span on EventEndSpan. The span structure can then be used by other exporters.

func Metric

func Metric(ctx context.Context, data telemetry.MetricData)

func ProcessEvent

func ProcessEvent(ctx context.Context, event telemetry.Event) context.Context

func SetExporter

func SetExporter(e Exporter)

func Tag

func Tag(ctx context.Context, event telemetry.Event) context.Context

Tag returns a context updated with tag values from the event. It ignores events that are not or type EventTag or EventStartSpan.

Types

type Exporter

type Exporter interface {
	// ProcessEvent is a function that handles all events.
	// Exporters may use information in the context to decide what to do with a
	// given event.
	ProcessEvent(context.Context, telemetry.Event) context.Context

	Metric(context.Context, telemetry.MetricData)
}

func LogWriter

func LogWriter(w io.Writer, onlyErrors bool) Exporter

LogWriter returns an observer that logs events to the supplied writer. If onlyErrors is true it does not log any event that did not have an associated error. It ignores all telemetry other than log events.

type Span

type Span struct {
	Name     string
	ID       SpanContext
	ParentID SpanID
	Start    time.Time
	Finish   time.Time
	Tags     telemetry.TagList
	Events   []telemetry.Event
}

func GetSpan

func GetSpan(ctx context.Context) *Span

func (*Span) Format

func (s *Span) Format(f fmt.State, r rune)

type SpanContext

type SpanContext struct {
	TraceID TraceID
	SpanID  SpanID
}

func (*SpanContext) Format

func (s *SpanContext) Format(f fmt.State, r rune)

type SpanID

type SpanID [8]byte

func (SpanID) IsValid

func (s SpanID) IsValid() bool

func (SpanID) String

func (s SpanID) String() string

type TraceID

type TraceID [16]byte

func (TraceID) String

func (t TraceID) String() string

Directories

Path Synopsis
Package ocagent adds the ability to export all telemetry to an ocagent.
Package ocagent adds the ability to export all telemetry to an ocagent.

Jump to

Keyboard shortcuts

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