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.
const ( KeyTraceID = "trace_id" KeySpanID = "span_id" KeyPrefixTag = "tag:" )
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 ¶
Attachments is a map of extra values associated with a recorded data point. The map should only be mutated from AttachmentExtractor functions.