Documentation ¶
Overview ¶
Package tag provides support for telemetry tagging.
Package tag provides support for telemetry tagging. This package is a thin shim over contexts with the main addition being the the ability to observe when contexts get tagged with new values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Observe ¶ added in v0.0.22
func Observe(observer Observer)
Observe adds a new tag observer to the registered set. There is no way to ever unregister a observer. Observers are free to use context information to control their behavior.
Types ¶
type Key ¶
type Key string
Key represents the key for a context tag. It is a helper to make use of context tagging slightly easier to read, it is not strictly needed to use it at all. It is intended that your common tagging keys are declared as constants of this type, and then you can use the methods of this type to apply and find those values in the context.
type List ¶ added in v0.0.22
type List []Tag
List 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 Get ¶ added in v0.0.22
Get collects a set of values from the context and returns them as a tag list.
func (List) Format ¶ added in v0.0.22
Format pretty prints a list. It is intended only for debugging.
type Observer ¶ added in v0.0.22
Observer is the type for a function that wants to be notified when new tags are set on a context. If you use context.WithValue (or equivalent) it will bypass the observers, you must use the setters in this package for tags that should be observed. Register new observers with the Observe function.