package keys

import "golang.org/x/tools/internal/event/keys"

Index

Variables

var (
	// Msg is a key used to add message strings to label lists.
	Msg = NewString("message", "a readable message")
	// Label is a key used to indicate an event adds labels to the context.
	Label = NewTag("label", "a label context marker")
	// Start is used for things like traces that have a name.
	Start = NewString("start", "span start")
	// Metric is a key used to indicate an event records metrics.
	End = NewTag("end", "a span end marker")
	// Metric is a key used to indicate an event records metrics.
	Detach = NewTag("detach", "a span detach marker")
	// Err is a key used to add error values to label lists.
	Err = NewError("error", "an error that occurred")
	// Metric is a key used to indicate an event records metrics.
	Metric = NewTag("metric", "a metric event marker")
)

Functions

func Join

func Join[S ~[]T, T ~string](s S) string

Join returns a canonical join of the keys in S: a sorted comma-separated string list.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error represents a key

func NewError

func NewError(name, description string) *Error

NewError returns a new label.Key for error values.

func (*Error) Append

func (k *Error) Append(buf []byte, l label.Label) []byte

func (*Error) Description

func (k *Error) Description() string

func (*Error) From

func (k *Error) From(t label.Label) error

From returns the value of a Label.

func (*Error) Get

func (k *Error) Get(lm label.Map) error

Get returns the label for the key of a label.Map.

func (*Error) Name

func (k *Error) Name() string

func (*Error) Of

func (k *Error) Of(v error) label.Label

Of returns a new Label with this key and the supplied value.

type Float

type Float struct {
	// contains filtered or unexported fields
}

Float is a label.Key for floating-point values.

func NewFloat

func NewFloat(name, description string) *Float

NewFloat creates a new label.Key for floating-point values.

func (*Float) Append

func (k *Float) Append(buf []byte, l label.Label) []byte

func (*Float) Description

func (k *Float) Description() string

func (*Float) From

func (k *Float) From(t label.Label) float64

From returns the value of a Label.

func (*Float) Get

func (k *Float) Get(lm label.Map) float64

Get returns the label for the key of a label.Map.

func (*Float) Name

func (k *Float) Name() string

func (*Float) Of

func (k *Float) Of(v float64) label.Label

Of creates a new Label with this key and the supplied value.

type Int

type Int struct {
	// contains filtered or unexported fields
}

Int is a label.Key for signed integers.

func NewInt

func NewInt(name, description string) *Int

NewInt returns a new label.Key for int64 values.

func (*Int) Append

func (k *Int) Append(buf []byte, l label.Label) []byte

func (*Int) Description

func (k *Int) Description() string

func (*Int) From

func (k *Int) From(t label.Label) int64

From returns the value of a Label.

func (*Int) Get

func (k *Int) Get(lm label.Map) int64

Get returns the label for the key of a label.Map.

func (*Int) Name

func (k *Int) Name() string

func (*Int) Of

func (k *Int) Of(v int) label.Label

Of creates a new Label with this key and the supplied value.

func (*Int) Of64

func (k *Int) Of64(v int64) label.Label

Of64 creates a new Label with this key and the supplied value.

type String

type String struct {
	// contains filtered or unexported fields
}

String represents a key

func NewString

func NewString(name, description string) *String

NewString creates a new Key for int64 values.

func (*String) Append

func (k *String) Append(buf []byte, l label.Label) []byte

func (*String) Description

func (k *String) Description() string

func (*String) From

func (k *String) From(t label.Label) string

From returns the value of a Label.

func (*String) Get

func (k *String) Get(lm label.Map) string

Get returns the label for the key of a label.Map.

func (*String) Name

func (k *String) Name() string

func (*String) Of

func (k *String) Of(v string) label.Label

Of creates a new Label with this key and the supplied value.

type Tag

type Tag struct {
	// contains filtered or unexported fields
}

Tag represents a key for tagging labels that have no value. These are used when the existence of the label is the entire information it carries, such as marking events to be of a specific kind, or from a specific package.

func NewTag

func NewTag(name, description string) *Tag

NewTag creates a new label.Key for tagging labels.

func (*Tag) Append

func (k *Tag) Append(buf []byte, l label.Label) []byte

func (*Tag) Description

func (k *Tag) Description() string

func (*Tag) Name

func (k *Tag) Name() string

func (*Tag) New

func (k *Tag) New() label.Label

New creates a new Label with this key.

type Uint

type Uint struct {
	// contains filtered or unexported fields
}

Uint is a label.Key for unsigned integers.

func NewUint

func NewUint(name, description string) *Uint

NewUint creates a new label.Key for unsigned values.

func (*Uint) Append

func (k *Uint) Append(buf []byte, l label.Label) []byte

func (*Uint) Description

func (k *Uint) Description() string

func (*Uint) From

func (k *Uint) From(t label.Label) uint64

From returns the value of a Label.

func (*Uint) Get

func (k *Uint) Get(lm label.Map) uint64

Get returns the label for the key of a label.Map.

func (*Uint) Name

func (k *Uint) Name() string

func (*Uint) Of

func (k *Uint) Of(v uint64) label.Label

Of creates a new Label with this key and the supplied value.

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value is a label.Key for untyped values.

func New

func New(name, description string) *Value

New creates a new Key for untyped values.

func (*Value) Append

func (k *Value) Append(buf []byte, l label.Label) []byte

func (*Value) Description

func (k *Value) Description() string

func (*Value) From

func (k *Value) From(t label.Label) any

From returns the value of a Label.

func (*Value) Get

func (k *Value) Get(lm label.Map) any

Get returns the label for the key of a label.Map.

func (*Value) Name

func (k *Value) Name() string

func (*Value) Of

func (k *Value) Of(value any) label.Label

Of creates a new Label with this key and the supplied value.

Source Files

keys.go standard.go util.go

Version
v0.44.0 (latest)
Published
Apr 9, 2026
Platform
linux/amd64
Imports
6 packages
Last checked
1 hour ago

Tools for package owners.