Documentation

Overview

    Package telemetry provides an opinionated set of packages that cover the main concepts of telemetry in an implementation agnostic way. As a library author you should look at

    stats (for aggregatable measurements)
    trace (for scoped timing spans)
    log (for for time based events)
    

    As a binary author you might look at

    metric (for methods of aggregating stats)
    exporter (for methods of exporting the telemetry to external tools)
    debug (for serving internal http pages of some of the telemetry)
    

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func WithSpan

    func WithSpan(ctx context.Context, span *Span) context.Context

    Types

    type Event

    type Event struct {
    	At      time.Time
    	Message string
    	Error   error
    	Tags    TagList
    }

    func (Event) Format

    func (e Event) Format(f fmt.State, r rune)

    type MetricData

    type MetricData interface {
    	// Handle returns the metric handle this data is for.
    	Handle() string
    	// Groups reports the rows that currently exist for this metric.
    	Groups() []TagList
    }

      Data represents a single point in the time series of a metric. This provides the common interface to all metrics no matter their data format. To get the actual values for the metric you must type assert to a concrete metric type.

      type Span

      type Span struct {
      	Name     string
      	ID       SpanContext
      	ParentID SpanID
      	Start    time.Time
      	Finish   time.Time
      	Tags     TagList
      	Events   []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 NewSpanID

      func NewSpanID() SpanID

      func (SpanID) IsValid

      func (s SpanID) IsValid() bool

      func (SpanID) String

      func (s SpanID) String() string

      type Tag

      type Tag struct {
      	Key   interface{}
      	Value interface{}
      }

        Tag holds a key and value pair. It is normally used when passing around lists of tags.

        func (Tag) Format

        func (t Tag) Format(f fmt.State, r rune)

          Format is used for debug printing of tags.

          func (Tag) Tag

          func (t Tag) Tag(ctx context.Context) Tag

            Get returns the tag unmodified. It makes Key conform to the Tagger interface.

            type TagList

            type TagList []Tag

              TagList is a way of passing around a collection of key value pairs. It is an alternative to the less efficient and unordered method of using maps.

              func (TagList) Equal

              func (l TagList) Equal(other TagList) bool

                Equal returns true if two lists are identical.

                func (TagList) Format

                func (l TagList) Format(f fmt.State, r rune)

                  Format pretty prints a list. It is intended only for debugging.

                  func (TagList) Get

                  func (l TagList) Get(k interface{}) interface{}

                    Get will get a single key's value from the list.

                    func (TagList) Less

                    func (l TagList) Less(other TagList) bool

                      Less is intended only for using tag lists as a sorting key.

                      type TraceID

                      type TraceID [16]byte

                      func NewTraceID

                      func NewTraceID() TraceID

                      func (TraceID) String

                      func (t TraceID) String() string

                      Directories

                      Path Synopsis
                      Package export holds the definition of the telemetry Exporter interface, along with some simple implementations.
                      Package export holds the definition of the telemetry Exporter interface, along with some simple implementations.
                      ocagent
                      Package ocagent adds the ability to export all telemetry to an ocagent.
                      Package ocagent adds the ability to export all telemetry to an ocagent.
                      Package log is a context based logging package, designed to interact well with both the lsp protocol and the other telemetry packages.
                      Package log is a context based logging package, designed to interact well with both the lsp protocol and the other telemetry packages.
                      Package metric aggregates stats into metrics that can be exported.
                      Package metric aggregates stats into metrics that can be exported.
                      Package stats provides support for recording telemetry statistics.
                      Package stats provides support for recording telemetry statistics.
                      Package tag provides support for telemetry tagging.
                      Package tag provides support for telemetry tagging.
                      Package trace adds support for telemetry tracing.
                      Package trace adds support for telemetry tracing.
                      Package unit holds the definitions for the units you can use in telemetry.
                      Package unit holds the definitions for the units you can use in telemetry.