package cpuconv

import "go.opentelemetry.io/otel/semconv/v1.32.0/cpuconv"

Package httpconv provides types and functionality for OpenTelemetry semantic conventions in the "cpu" namespace.

Index

Types

type Frequency

type Frequency struct {
	metric.Int64Gauge
}

Frequency is an instrument used to record metric values conforming to the "cpu.frequency" semantic conventions. It represents the operating frequency of the logical CPU in Hertz.

func NewFrequency

func NewFrequency(
	m metric.Meter,
	opt ...metric.Int64GaugeOption,
) (Frequency, error)

NewFrequency returns a new Frequency instrument.

func (Frequency) AttrLogicalNumber

func (Frequency) AttrLogicalNumber(val int) attribute.KeyValue

AttrLogicalNumber returns an optional attribute for the "cpu.logical_number" semantic convention. It represents the logical CPU number [0..n-1].

func (Frequency) Description

func (Frequency) Description() string

Description returns the semantic convention description of the instrument

func (Frequency) Inst

func (m Frequency) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

func (Frequency) Name

func (Frequency) Name() string

Name returns the semantic convention name of the instrument.

func (Frequency) Record

func (m Frequency) Record(
	ctx context.Context,
	val int64,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

All additional attrs passed are included in the recorded value.

func (Frequency) Unit

func (Frequency) Unit() string

Unit returns the semantic convention unit of the instrument

type ModeAttr

type ModeAttr string

ModeAttr is an attribute conforming to the cpu.mode semantic conventions. It represents the mode of the CPU.

var (
	// ModeUser is the none.
	ModeUser ModeAttr = "user"
	// ModeSystem is the none.
	ModeSystem ModeAttr = "system"
	// ModeNice is the none.
	ModeNice ModeAttr = "nice"
	// ModeIdle is the none.
	ModeIdle ModeAttr = "idle"
	// ModeIOWait is the none.
	ModeIOWait ModeAttr = "iowait"
	// ModeInterrupt is the none.
	ModeInterrupt ModeAttr = "interrupt"
	// ModeSteal is the none.
	ModeSteal ModeAttr = "steal"
	// ModeKernel is the none.
	ModeKernel ModeAttr = "kernel"
)

type Time

type Time struct {
	metric.Float64ObservableCounter
}

Time is an instrument used to record metric values conforming to the "cpu.time" semantic conventions. It represents the seconds each logical CPU spent on each mode.

func NewTime

NewTime returns a new Time instrument.

func (Time) AttrLogicalNumber

func (Time) AttrLogicalNumber(val int) attribute.KeyValue

AttrLogicalNumber returns an optional attribute for the "cpu.logical_number" semantic convention. It represents the logical CPU number [0..n-1].

func (Time) AttrMode

func (Time) AttrMode(val ModeAttr) attribute.KeyValue

AttrMode returns an optional attribute for the "cpu.mode" semantic convention. It represents the mode of the CPU.

func (Time) Description

func (Time) Description() string

Description returns the semantic convention description of the instrument

func (Time) Inst

Inst returns the underlying metric instrument.

func (Time) Name

func (Time) Name() string

Name returns the semantic convention name of the instrument.

func (Time) Unit

func (Time) Unit() string

Unit returns the semantic convention unit of the instrument

type Utilization

type Utilization struct {
	metric.Int64Gauge
}

Utilization is an instrument used to record metric values conforming to the "cpu.utilization" semantic conventions. It represents the for each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time.

func NewUtilization

func NewUtilization(
	m metric.Meter,
	opt ...metric.Int64GaugeOption,
) (Utilization, error)

NewUtilization returns a new Utilization instrument.

func (Utilization) AttrLogicalNumber

func (Utilization) AttrLogicalNumber(val int) attribute.KeyValue

AttrLogicalNumber returns an optional attribute for the "cpu.logical_number" semantic convention. It represents the logical CPU number [0..n-1].

func (Utilization) AttrMode

func (Utilization) AttrMode(val ModeAttr) attribute.KeyValue

AttrMode returns an optional attribute for the "cpu.mode" semantic convention. It represents the mode of the CPU.

func (Utilization) Description

func (Utilization) Description() string

Description returns the semantic convention description of the instrument

func (Utilization) Inst

func (m Utilization) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

func (Utilization) Name

func (Utilization) Name() string

Name returns the semantic convention name of the instrument.

func (Utilization) Record

func (m Utilization) Record(
	ctx context.Context,
	val int64,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

All additional attrs passed are included in the recorded value.

func (Utilization) Unit

func (Utilization) Unit() string

Unit returns the semantic convention unit of the instrument

Source Files

metric.go

Version
v1.36.0 (latest)
Published
May 21, 2025
Platform
js/wasm
Imports
5 packages
Last checked
4 hours ago

Tools for package owners.