tools: Index | Files | Directories

package telemetry

import ""

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)


Package Files

context.go doc.go event.go id.go metric.go tag.go trace.go

func WithSpan Uses

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

type Event Uses

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

func (Event) Format Uses

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

type MetricData Uses

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 Uses

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

func GetSpan Uses

func GetSpan(ctx context.Context) *Span

func (*Span) Format Uses

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

type SpanContext Uses

type SpanContext struct {
    TraceID TraceID
    SpanID  SpanID

func (*SpanContext) Format Uses

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

type SpanID Uses

type SpanID [8]byte

func NewSpanID Uses

func NewSpanID() SpanID

func (SpanID) IsValid Uses

func (s SpanID) IsValid() bool

func (SpanID) String Uses

func (s SpanID) String() string

type Tag Uses

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 Uses

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

Format is used for debug printing of tags.

func (Tag) Tag Uses

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

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

type TagList Uses

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 Uses

func (l TagList) Equal(other TagList) bool

Equal returns true if two lists are identical.

func (TagList) Format Uses

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

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

func (TagList) Get Uses

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

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

func (TagList) Less Uses

func (l TagList) Less(other TagList) bool

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

type TraceID Uses

type TraceID [16]byte

func NewTraceID Uses

func NewTraceID() TraceID

func (TraceID) String Uses

func (t TraceID) String() string


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

Package telemetry imports 8 packages (graph) and is imported by 27 packages. Updated 2020-02-23. Refresh now. Tools for package owners.