attribute

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Unlicense Imports: 3 Imported by: 0

Documentation

Overview

Package attribute provides a simplified wrapper around OpenTelemetry attributes. It offers automatic type detection and standard resource attribute creation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToKeyValues

func ToKeyValues(attrs []Attr) []attribute.KeyValue

ToKeyValues converts a slice of Attr to an OpenTelemetry KeyValue slice.

Types

type Attr

type Attr struct {
	attribute.KeyValue
}

Attr wraps an OpenTelemetry KeyValue attribute.

func New

func New(key string, value any) Attr

New creates an attribute with automatic type detection. Supported types: bool, []bool, float64, []float64, int, []int, int64, []int64, string, []string. Other types are converted using fmt.Stringer or formatted with %v.

func ResourceAttributes

func ResourceAttributes(serviceName string, serviceVersion string, environment string, hostname string) []Attr

ResourceAttributes creates standard resource attributes for a service.

Jump to

Keyboard shortcuts

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