Documentation
¶
Index ¶
- Variables
- func ExpectTagsOnContext(ctx context.Context, expectedTags ...*Tag) error
- func WithComponent(ctx context.Context, component string) context.Context
- func WithNamespaceTags(ctx context.Context, namespace string, tags ...*Tag) context.Context
- func WithTags(ctx context.Context, tags ...*Tag) context.Context
- type Key
- type Set
- type Tag
- type Type
- type Value
Constants ¶
This section is empty.
Variables ¶
var DefaultNamespace = ""
DefaultNamespace is the default namespace for tags
var EmptySet = Set{}
Functions ¶
func ExpectTagsOnContext ¶ added in v0.3.0
func WithComponent ¶
WithComponent returns a new context with the component chained tag added to the default namespace set.
func WithNamespaceTags ¶
WithNamespaceTags returns a new context with the given added to the namespace set. The namespace set on the parent context is not modified.
Types ¶
type Key ¶
type Key string
Key represents the key part in key-value pairs. It's a string. The allowed character set in the key depends on the use of the key.
type Set ¶
type Set []*Tag
Set represents a immutable set of
func FromContext ¶
FromContext returns the set of tags from the context for the default namespace set
func FromNamespaceContext ¶
FromNamespaceContext returns the set of tags for the given namespace from the context.
type Tag ¶
A tag is a key-value pair that can be attached to a context It is used to carry metadata about a given context execution along the context chain It is primarily used for rich instrumentation of the application: logging, metrics, tracing
func Float64Tag ¶
Float64Tag creates a new tag with a 64-bit floating point value.
type Type ¶
type Type int
Type describes the type of the Value holds.
const ( // INVALID is used for a Value with no value set. INVALID Type = iota // BOOL is a boolean Type Value. BOOL // INT64 is a 64-bit signed integral Type Value. INT64 // FLOAT64 is a 64-bit floating point Type Value. FLOAT64 // STRING is a string Type Value. STRING // OBJECT is a generic object Type Value. OBJECT )
type Value ¶
type Value struct { Type Type Interface interface{} }
Value represents a tag value.
func Float64Value ¶
Float64Value returns a Value with a 64-bit floating point value set.
func Int64Value ¶
Int64Value returns a Value with a 64-bit signed integral value set.
func ObjectValue ¶
func ObjectValue(v interface{}) Value
ObjectValue returns a Value with a generic object value set.
func StringValue ¶
StringValue returns a Value with a string value set.