Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

hwconv

v1.47.0
go.opentelemetry.io/otel/semconv/v1.32.0/hwconv

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

100 matches

Top ↑

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

Types

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.

NewEnergy

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

NewEnergy returns a new Energy instrument.

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.

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.

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).

Energy.Description

func (Energy) Description() string

Description returns the semantic convention description of the instrument

Energy.Inst

func (m Energy) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

Energy.Name

func (Energy) Name() string

Name returns the semantic convention name of the instrument.

Energy.Unit

func (Energy) Unit() string

Unit returns the semantic convention unit of the instrument

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.

ErrorTypeOther

var ErrorTypeOther ErrorTypeAttr = "_OTHER"

ErrorTypeOther is a fallback error value to be used when the instrumentation doesn't define a custom value.

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.

NewErrors

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

NewErrors returns a new Errors instrument.

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.

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.

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.

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).

Errors.Description

func (Errors) Description() string

Description returns the semantic convention description of the instrument

Errors.Inst

func (m Errors) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

Errors.Name

func (Errors) Name() string

Name returns the semantic convention name of the instrument.

Errors.Unit

func (Errors) Unit() string

Unit returns the semantic convention unit of the instrument

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.

NewHostAmbientTemperature

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

NewHostAmbientTemperature returns a new HostAmbientTemperature instrument.

HostAmbientTemperature.AttrName

func (HostAmbientTemperature) 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.

HostAmbientTemperature.AttrParent

func (HostAmbientTemperature) 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).

HostAmbientTemperature.Description

func (HostAmbientTemperature) Description() string

Description returns the semantic convention description of the instrument

HostAmbientTemperature.Inst

func (m HostAmbientTemperature) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

HostAmbientTemperature.Name

func (HostAmbientTemperature) Name() string

Name returns the semantic convention name of the instrument.

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.

HostAmbientTemperature.Unit

func (HostAmbientTemperature) Unit() string

Unit returns the semantic convention unit of the instrument

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.

NewHostEnergy

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

NewHostEnergy returns a new HostEnergy instrument.

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.

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.

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).

HostEnergy.Description

func (HostEnergy) Description() string

Description returns the semantic convention description of the instrument

HostEnergy.Inst

func (m HostEnergy) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

HostEnergy.Name

func (HostEnergy) Name() string

Name returns the semantic convention name of the instrument.

HostEnergy.Unit

func (HostEnergy) Unit() string

Unit returns the semantic convention unit of the instrument

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.

NewHostHeatingMargin

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

NewHostHeatingMargin returns a new HostHeatingMargin instrument.

HostHeatingMargin.AttrName

func (HostHeatingMargin) 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.

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).

HostHeatingMargin.Description

func (HostHeatingMargin) Description() string

Description returns the semantic convention description of the instrument

HostHeatingMargin.Inst

func (m HostHeatingMargin) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

HostHeatingMargin.Name

func (HostHeatingMargin) Name() string

Name returns the semantic convention name of the instrument.

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.

HostHeatingMargin.Unit

func (HostHeatingMargin) Unit() string

Unit returns the semantic convention unit of the instrument

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).

NewHostPower

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

NewHostPower returns a new HostPower instrument.

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.

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).

HostPower.Description

func (HostPower) Description() string

Description returns the semantic convention description of the instrument

HostPower.Inst

func (m HostPower) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

HostPower.Name

func (HostPower) Name() string

Name returns the semantic convention name of the instrument.

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.

HostPower.Unit

func (HostPower) Unit() string

Unit returns the semantic convention unit of the instrument

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.

NewPower

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

NewPower returns a new Power instrument.

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.

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).

Power.Description

func (Power) Description() string

Description returns the semantic convention description of the instrument

Power.Inst

func (m Power) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

Power.Name

func (Power) Name() string

Name returns the semantic convention name of the instrument.

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.

Power.Unit

func (Power) Unit() string

Unit returns the semantic convention unit of the instrument

StateAttr

type StateAttr string

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

StateOk (3 declarations)

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

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.

NewStatus

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

NewStatus returns a new Status instrument.

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.

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.

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).

Status.Description

func (Status) Description() string

Description returns the semantic convention description of the instrument

Status.Inst

func (m Status) Inst() metric.Int64UpDownCounter

Inst returns the underlying metric instrument.

Status.Name

func (Status) Name() string

Name returns the semantic convention name of the instrument.

Status.Unit

func (Status) Unit() string

Unit returns the semantic convention unit of the instrument

TypeAttr

type TypeAttr string

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

TypeBattery (14 declarations)

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"
)

Dependency graph