Documentation ¶
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.
Deprecated: Use go.opencensus.io/metric/metricdata instead.
Index ¶
Constants ¶
const ( KeyTraceID = "trace_id" KeySpanID = "span_id" KeyPrefixTag = "tag:" )
Exemplars keys.
Variables ¶
This section is empty.
Functions ¶
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.
Types ¶
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 ¶
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
AttachmentsFromContext 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
deprecated
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.
Deprecated: Use go.opencensus.io/metric/metricdata/exemplar instead.