cpuconv
v1.47.0
Documentation
pkg.go.dev ↗Package cpuconv provides types and functionality for OpenTelemetry semantic conventions in the "cpu" namespace.
Types
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.
NewFrequency
func NewFrequency( m metric.Meter, opt ...metric.Int64GaugeOption, ) (Frequency, error)
NewFrequency returns a new Frequency instrument.
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].
Frequency.Description
func (Frequency) Description() string
Description returns the semantic convention description of the instrument
Frequency.Inst
func (m Frequency) Inst() metric.Int64Gauge
Inst returns the underlying metric instrument.
Frequency.Name
func (Frequency) Name() string
Name returns the semantic convention name of the instrument.
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.
Frequency.Unit
func (Frequency) Unit() string
Unit returns the semantic convention unit of the instrument
ModeAttr
type ModeAttr string
ModeAttr is an attribute conforming to the cpu.mode semantic conventions. It represents the mode of the CPU.
ModeUser (8 declarations)
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" )
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.
NewTime
func NewTime( m metric.Meter, opt ...metric.Float64ObservableCounterOption, ) (Time, error)
NewTime returns a new Time instrument.
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].
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.
Time.Description
func (Time) Description() string
Description returns the semantic convention description of the instrument
Time.Inst
func (m Time) Inst() metric.Float64ObservableCounter
Inst returns the underlying metric instrument.
Time.Name
func (Time) Name() string
Name returns the semantic convention name of the instrument.
Time.Unit
func (Time) Unit() string
Unit returns the semantic convention unit of the instrument
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.
NewUtilization
func NewUtilization( m metric.Meter, opt ...metric.Int64GaugeOption, ) (Utilization, error)
NewUtilization returns a new Utilization instrument.
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].
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.
Utilization.Description
func (Utilization) Description() string
Description returns the semantic convention description of the instrument
Utilization.Inst
func (m Utilization) Inst() metric.Int64Gauge
Inst returns the underlying metric instrument.
Utilization.Name
func (Utilization) Name() string
Name returns the semantic convention name of the instrument.
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.
Utilization.Unit
func (Utilization) Unit() string
Unit returns the semantic convention unit of the instrument