Back to godoc.org
go.opencensus.io / exemplar

Package exemplar

v0.18.0
Latest Go to latest

The highest tagged major version is .

Published: Oct 22, 2018 | License: Apache-2.0 | Module: go.opencensus.io

Overview

Package exemplar implements support for exemplars. Exemplars are additional data associated with each measurement.

Their purpose it to provide an example of the kind of thing (request, RPC, trace span, etc.) that resulted in that measurement.

Index

Constants

const (
	KeyTraceID   = "trace_id"
	KeySpanID    = "span_id"
	KeyPrefixTag = "tag:"
)

func RegisterAttachmentExtractor

func RegisterAttachmentExtractor(e AttachmentExtractor)

RegisterAttachmentExtractor registers the given extractor associated with the exemplar type name.

Extractors will be used to attempt to extract exemplars from the context associated with each recorded measurement.

Packages that support exemplars should register their extractor functions on initialization.

RegisterAttachmentExtractor should not be called after any measurements have been recorded.

type AttachmentExtractor

type AttachmentExtractor func(ctx context.Context, a Attachments) Attachments

AttachmentExtractor is a function capable of extracting exemplar attachments from the context used to record measurements. The map passed to the function should be mutated and returned. It will initially be nil: the first AttachmentExtractor that would like to add keys to the map is responsible for initializing it.

type Attachments

type Attachments map[string]string

Attachments is a map of extra values associated with a recorded data point. The map should only be mutated from AttachmentExtractor functions.

func AttachmentsFromContext

func AttachmentsFromContext(ctx context.Context) Attachments

NewFromContext extracts exemplars from the given context. Each registered AttachmentExtractor (see RegisterAttachmentExtractor) is called in an unspecified order to add attachments to the exemplar.

type Exemplar

type Exemplar struct {
	Value       float64     // the value that was recorded
	Timestamp   time.Time   // the time the value was recorded
	Attachments Attachments // attachments (if any)
}

Exemplar is an example data point associated with each bucket of a distribution type aggregation.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier