package hwconv

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

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

Index

Types

type Energy

type Energy struct {
	metric.Int64Counter
}

Energy is an instrument used to record metric values conforming to the "hw.energy" semantic conventions. It represents the energy consumed by the component.

func NewEnergy

func NewEnergy(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (Energy, error)

NewEnergy returns a new Energy instrument.

func (Energy) Add

func (m Energy) Add(
	ctx context.Context,
	incr int64,
	id string,
	hwType TypeAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The id is the an identifier for the hardware component, unique within the monitored host

The hwType is the type of the component

All additional attrs passed are included in the recorded value.

func (Energy) AttrName

func (Energy) AttrName(val string) attribute.KeyValue

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (Energy) AttrParent

func (Energy) AttrParent(val string) attribute.KeyValue

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (Energy) Description

func (Energy) Description() string

Description returns the semantic convention description of the instrument

func (Energy) Inst

func (m Energy) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (Energy) Name

func (Energy) Name() string

Name returns the semantic convention name of the instrument.

func (Energy) Unit

func (Energy) Unit() string

Unit returns the semantic convention unit of the instrument

type ErrorTypeAttr

type ErrorTypeAttr string

ErrorTypeAttr is an attribute conforming to the error.type semantic conventions. It represents the type of error encountered by the component.

var (
	// ErrorTypeOther is a fallback error value to be used when the instrumentation
	// doesn't define a custom value.
	ErrorTypeOther ErrorTypeAttr = "_OTHER"
)

type Errors

type Errors struct {
	metric.Int64Counter
}

Errors is an instrument used to record metric values conforming to the "hw.errors" semantic conventions. It represents the number of errors encountered by the component.

func NewErrors

func NewErrors(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (Errors, error)

NewErrors returns a new Errors instrument.

func (Errors) Add

func (m Errors) Add(
	ctx context.Context,
	incr int64,
	id string,
	hwType TypeAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The id is the an identifier for the hardware component, unique within the monitored host

The hwType is the type of the component

All additional attrs passed are included in the recorded value.

func (Errors) AttrErrorType

func (Errors) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the type of error encountered by the component.

func (Errors) AttrName

func (Errors) AttrName(val string) attribute.KeyValue

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (Errors) AttrParent

func (Errors) AttrParent(val string) attribute.KeyValue

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (Errors) Description

func (Errors) Description() string

Description returns the semantic convention description of the instrument

func (Errors) Inst

func (m Errors) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (Errors) Name

func (Errors) Name() string

Name returns the semantic convention name of the instrument.

func (Errors) Unit

func (Errors) Unit() string

Unit returns the semantic convention unit of the instrument

type HostAmbientTemperature

type HostAmbientTemperature struct {
	metric.Int64Gauge
}

HostAmbientTemperature is an instrument used to record metric values conforming to the "hw.host.ambient_temperature" semantic conventions. It represents the ambient (external) temperature of the physical host.

func NewHostAmbientTemperature

func NewHostAmbientTemperature(
	m metric.Meter,
	opt ...metric.Int64GaugeOption,
) (HostAmbientTemperature, error)

NewHostAmbientTemperature returns a new HostAmbientTemperature instrument.

func (HostAmbientTemperature) AttrName

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (HostAmbientTemperature) AttrParent

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (HostAmbientTemperature) Description

func (HostAmbientTemperature) Description() string

Description returns the semantic convention description of the instrument

func (HostAmbientTemperature) Inst

Inst returns the underlying metric instrument.

func (HostAmbientTemperature) Name

Name returns the semantic convention name of the instrument.

func (HostAmbientTemperature) Record

func (m HostAmbientTemperature) Record(
	ctx context.Context,
	val int64,
	id string,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

The id is the an identifier for the hardware component, unique within the monitored host

All additional attrs passed are included in the recorded value.

func (HostAmbientTemperature) Unit

Unit returns the semantic convention unit of the instrument

type HostEnergy

type HostEnergy struct {
	metric.Int64Counter
}

HostEnergy is an instrument used to record metric values conforming to the "hw.host.energy" semantic conventions. It represents the total energy consumed by the entire physical host, in joules.

func NewHostEnergy

func NewHostEnergy(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (HostEnergy, error)

NewHostEnergy returns a new HostEnergy instrument.

func (HostEnergy) Add

func (m HostEnergy) Add(
	ctx context.Context,
	incr int64,
	id string,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The id is the an identifier for the hardware component, unique within the monitored host

All additional attrs passed are included in the recorded value.

The overall energy usage of a host MUST be reported using the specific `hw.host.energy` and `hw.host.power` metrics **only**, instead of the generic `hw.energy` and `hw.power` described in the previous section, to prevent summing up overlapping values.

func (HostEnergy) AttrName

func (HostEnergy) AttrName(val string) attribute.KeyValue

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (HostEnergy) AttrParent

func (HostEnergy) AttrParent(val string) attribute.KeyValue

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (HostEnergy) Description

func (HostEnergy) Description() string

Description returns the semantic convention description of the instrument

func (HostEnergy) Inst

func (m HostEnergy) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (HostEnergy) Name

func (HostEnergy) Name() string

Name returns the semantic convention name of the instrument.

func (HostEnergy) Unit

func (HostEnergy) Unit() string

Unit returns the semantic convention unit of the instrument

type HostHeatingMargin

type HostHeatingMargin struct {
	metric.Int64Gauge
}

HostHeatingMargin is an instrument used to record metric values conforming to the "hw.host.heating_margin" semantic conventions. It represents the by how many degrees Celsius the temperature of the physical host can be increased, before reaching a warning threshold on one of the internal sensors.

func NewHostHeatingMargin

func NewHostHeatingMargin(
	m metric.Meter,
	opt ...metric.Int64GaugeOption,
) (HostHeatingMargin, error)

NewHostHeatingMargin returns a new HostHeatingMargin instrument.

func (HostHeatingMargin) AttrName

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (HostHeatingMargin) AttrParent

func (HostHeatingMargin) AttrParent(val string) attribute.KeyValue

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (HostHeatingMargin) Description

func (HostHeatingMargin) Description() string

Description returns the semantic convention description of the instrument

func (HostHeatingMargin) Inst

Inst returns the underlying metric instrument.

func (HostHeatingMargin) Name

func (HostHeatingMargin) Name() string

Name returns the semantic convention name of the instrument.

func (HostHeatingMargin) Record

func (m HostHeatingMargin) Record(
	ctx context.Context,
	val int64,
	id string,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

The id is the an identifier for the hardware component, unique within the monitored host

All additional attrs passed are included in the recorded value.

func (HostHeatingMargin) Unit

func (HostHeatingMargin) Unit() string

Unit returns the semantic convention unit of the instrument

type HostPower

type HostPower struct {
	metric.Int64Gauge
}

HostPower is an instrument used to record metric values conforming to the "hw.host.power" semantic conventions. It represents the instantaneous power consumed by the entire physical host in Watts (`hw.host.energy` is preferred).

func NewHostPower

func NewHostPower(
	m metric.Meter,
	opt ...metric.Int64GaugeOption,
) (HostPower, error)

NewHostPower returns a new HostPower instrument.

func (HostPower) AttrName

func (HostPower) AttrName(val string) attribute.KeyValue

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (HostPower) AttrParent

func (HostPower) AttrParent(val string) attribute.KeyValue

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (HostPower) Description

func (HostPower) Description() string

Description returns the semantic convention description of the instrument

func (HostPower) Inst

func (m HostPower) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

func (HostPower) Name

func (HostPower) Name() string

Name returns the semantic convention name of the instrument.

func (HostPower) Record

func (m HostPower) Record(
	ctx context.Context,
	val int64,
	id string,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

The id is the an identifier for the hardware component, unique within the monitored host

All additional attrs passed are included in the recorded value.

The overall energy usage of a host MUST be reported using the specific `hw.host.energy` and `hw.host.power` metrics **only**, instead of the generic `hw.energy` and `hw.power` described in the previous section, to prevent summing up overlapping values.

func (HostPower) Unit

func (HostPower) Unit() string

Unit returns the semantic convention unit of the instrument

type Power

type Power struct {
	metric.Int64Gauge
}

Power is an instrument used to record metric values conforming to the "hw.power" semantic conventions. It represents the instantaneous power consumed by the component.

func NewPower

func NewPower(
	m metric.Meter,
	opt ...metric.Int64GaugeOption,
) (Power, error)

NewPower returns a new Power instrument.

func (Power) AttrName

func (Power) AttrName(val string) attribute.KeyValue

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (Power) AttrParent

func (Power) AttrParent(val string) attribute.KeyValue

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (Power) Description

func (Power) Description() string

Description returns the semantic convention description of the instrument

func (Power) Inst

func (m Power) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

func (Power) Name

func (Power) Name() string

Name returns the semantic convention name of the instrument.

func (Power) Record

func (m Power) Record(
	ctx context.Context,
	val int64,
	id string,
	hwType TypeAttr,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

The id is the an identifier for the hardware component, unique within the monitored host

The hwType is the type of the component

All additional attrs passed are included in the recorded value.

It is recommended to report `hw.energy` instead of `hw.power` when possible.

func (Power) Unit

func (Power) Unit() string

Unit returns the semantic convention unit of the instrument

type StateAttr

type StateAttr string

StateAttr is an attribute conforming to the hw.state semantic conventions. It represents the current state of the component.

var (
	// StateOk is the ok.
	StateOk StateAttr = "ok"
	// StateDegraded is the degraded.
	StateDegraded StateAttr = "degraded"
	// StateFailed is the failed.
	StateFailed StateAttr = "failed"
)

type Status

type Status struct {
	metric.Int64UpDownCounter
}

Status is an instrument used to record metric values conforming to the "hw.status" semantic conventions. It represents the operational status: `1` (true) or `0` (false) for each of the possible states.

func NewStatus

func NewStatus(
	m metric.Meter,
	opt ...metric.Int64UpDownCounterOption,
) (Status, error)

NewStatus returns a new Status instrument.

func (Status) Add

func (m Status) Add(
	ctx context.Context,
	incr int64,
	id string,
	state StateAttr,
	hwType TypeAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The id is the an identifier for the hardware component, unique within the monitored host

The state is the the current state of the component

The hwType is the type of the component

All additional attrs passed are included in the recorded value.

`hw.status` is currently specified as an *UpDownCounter* but would ideally be represented using a [*StateSet* as defined in OpenMetrics]. This semantic convention will be updated once *StateSet* is specified in OpenTelemetry. This planned change is not expected to have any consequence on the way users query their timeseries backend to retrieve the values of `hw.status` over time.

func (Status) AttrName

func (Status) AttrName(val string) attribute.KeyValue

AttrName returns an optional attribute for the "hw.name" semantic convention. It represents an easily-recognizable name for the hardware component.

func (Status) AttrParent

func (Status) AttrParent(val string) attribute.KeyValue

AttrParent returns an optional attribute for the "hw.parent" semantic convention. It represents the unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).

func (Status) Description

func (Status) Description() string

Description returns the semantic convention description of the instrument

func (Status) Inst

func (m Status) Inst() metric.Int64UpDownCounter

Inst returns the underlying metric instrument.

func (Status) Name

func (Status) Name() string

Name returns the semantic convention name of the instrument.

func (Status) Unit

func (Status) Unit() string

Unit returns the semantic convention unit of the instrument

type TypeAttr

type TypeAttr string

TypeAttr is an attribute conforming to the hw.type semantic conventions. It represents the type of the component.

var (
	// TypeBattery is the battery.
	TypeBattery TypeAttr = "battery"
	// TypeCPU is the CPU.
	TypeCPU TypeAttr = "cpu"
	// TypeDiskController is the disk controller.
	TypeDiskController TypeAttr = "disk_controller"
	// TypeEnclosure is the enclosure.
	TypeEnclosure TypeAttr = "enclosure"
	// TypeFan is the fan.
	TypeFan TypeAttr = "fan"
	// TypeGpu is the GPU.
	TypeGpu TypeAttr = "gpu"
	// TypeLogicalDisk is the logical disk.
	TypeLogicalDisk TypeAttr = "logical_disk"
	// TypeMemory is the memory.
	TypeMemory TypeAttr = "memory"
	// TypeNetwork is the network.
	TypeNetwork TypeAttr = "network"
	// TypePhysicalDisk is the physical disk.
	TypePhysicalDisk TypeAttr = "physical_disk"
	// TypePowerSupply is the power supply.
	TypePowerSupply TypeAttr = "power_supply"
	// TypeTapeDrive is the tape drive.
	TypeTapeDrive TypeAttr = "tape_drive"
	// TypeTemperature is the temperature.
	TypeTemperature TypeAttr = "temperature"
	// TypeVoltage is the voltage.
	TypeVoltage TypeAttr = "voltage"
)

Source Files

metric.go

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

Tools for package owners.