attribute

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package attribute provides typed key-value pairs for annotating trace spans.

Use this package to attach contextual information to spans when tracing operations in your application. Attributes support string, integer, float, and boolean value types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

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

Attribute represents a key-value pair with a specific type.

func Bool

func Bool(key string, value bool) *Attribute

Bool creates a new boolean attribute with the given key and value.

func Float

func Float(key string, value float64) *Attribute

Float creates a new float attribute with the given key and value.

func Int

func Int(key string, value int64) *Attribute

Int creates a new integer attribute with the given key and value.

func String

func String(key string, value string) *Attribute

String creates a new string attribute with the given key and value.

func (*Attribute) AsString

func (a *Attribute) AsString() string

AsString returns a string representation of the attribute's value.

func (*Attribute) BoolValue

func (a *Attribute) BoolValue() bool

BoolValue returns the attribute's value as a bool.

func (*Attribute) FloatValue

func (a *Attribute) FloatValue() float64

FloatValue returns the attribute's value as a float64.

func (*Attribute) IntValue

func (a *Attribute) IntValue() int64

IntValue returns the attribute's value as an int64.

func (*Attribute) Key

func (a *Attribute) Key() string

Key returns the attribute's key.

func (*Attribute) StringValue

func (a *Attribute) StringValue() string

StringValue returns the attribute's value as a string.

func (*Attribute) Type

func (a *Attribute) Type() Type

Type returns the attribute's type.

type Type

type Type int

Type represents an attribute's data type.

const (
	// TypeString represents a string attribute type.
	TypeString Type = iota + 1

	// TypeInt represents an integer attribute type.
	TypeInt

	// TypeFloat represents a float attribute type.
	TypeFloat

	// TypeBool represents a boolean attribute type.
	TypeBool
)

func (Type) String

func (t Type) String() string

String returns a string representation of the attribute type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL