package processconv

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

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

Index

Types

type CPUModeAttr

type CPUModeAttr string

CPUModeAttr is an attribute conforming to the cpu.mode semantic conventions. It represents a process SHOULD be characterized *either* by data points with no `mode` labels, *or only* data points with `mode` labels.

var (
	// CPUModeUser is the none.
	CPUModeUser CPUModeAttr = "user"
	// CPUModeSystem is the none.
	CPUModeSystem CPUModeAttr = "system"
	// CPUModeNice is the none.
	CPUModeNice CPUModeAttr = "nice"
	// CPUModeIdle is the none.
	CPUModeIdle CPUModeAttr = "idle"
	// CPUModeIOWait is the none.
	CPUModeIOWait CPUModeAttr = "iowait"
	// CPUModeInterrupt is the none.
	CPUModeInterrupt CPUModeAttr = "interrupt"
	// CPUModeSteal is the none.
	CPUModeSteal CPUModeAttr = "steal"
	// CPUModeKernel is the none.
	CPUModeKernel CPUModeAttr = "kernel"
)

type CPUTime

type CPUTime struct {
	metric.Float64ObservableCounter
}

CPUTime is an instrument used to record metric values conforming to the "process.cpu.time" semantic conventions. It represents the total CPU seconds broken down by different states.

func NewCPUTime

func NewCPUTime(
	m metric.Meter,
	opt ...metric.Float64ObservableCounterOption,
) (CPUTime, error)

NewCPUTime returns a new CPUTime instrument.

func (CPUTime) AttrCPUMode

func (CPUTime) AttrCPUMode(val CPUModeAttr) attribute.KeyValue

AttrCPUMode returns an optional attribute for the "cpu.mode" semantic convention. It represents a process SHOULD be characterized *either* by data points with no `mode` labels, *or only* data points with `mode` labels.

func (CPUTime) Description

func (CPUTime) Description() string

Description returns the semantic convention description of the instrument

func (CPUTime) Inst

Inst returns the underlying metric instrument.

func (CPUTime) Name

func (CPUTime) Name() string

Name returns the semantic convention name of the instrument.

func (CPUTime) Unit

func (CPUTime) Unit() string

Unit returns the semantic convention unit of the instrument

type CPUUtilization

type CPUUtilization struct {
	metric.Int64Gauge
}

CPUUtilization is an instrument used to record metric values conforming to the "process.cpu.utilization" semantic conventions. It represents the difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process.

func NewCPUUtilization

func NewCPUUtilization(
	m metric.Meter,
	opt ...metric.Int64GaugeOption,
) (CPUUtilization, error)

NewCPUUtilization returns a new CPUUtilization instrument.

func (CPUUtilization) AttrCPUMode

func (CPUUtilization) AttrCPUMode(val CPUModeAttr) attribute.KeyValue

AttrCPUMode returns an optional attribute for the "cpu.mode" semantic convention. It represents a process SHOULD be characterized *either* by data points with no `mode` labels, *or only* data points with `mode` labels.

func (CPUUtilization) Description

func (CPUUtilization) Description() string

Description returns the semantic convention description of the instrument

func (CPUUtilization) Inst

func (m CPUUtilization) Inst() metric.Int64Gauge

Inst returns the underlying metric instrument.

func (CPUUtilization) Name

func (CPUUtilization) Name() string

Name returns the semantic convention name of the instrument.

func (CPUUtilization) Record

func (m CPUUtilization) 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 (CPUUtilization) Unit

func (CPUUtilization) Unit() string

Unit returns the semantic convention unit of the instrument

type ContextSwitchTypeAttr

type ContextSwitchTypeAttr string

ContextSwitchTypeAttr is an attribute conforming to the process.context_switch_type semantic conventions. It represents the specifies whether the context switches for this data point were voluntary or involuntary.

var (
	// ContextSwitchTypeVoluntary is the none.
	ContextSwitchTypeVoluntary ContextSwitchTypeAttr = "voluntary"
	// ContextSwitchTypeInvoluntary is the none.
	ContextSwitchTypeInvoluntary ContextSwitchTypeAttr = "involuntary"
)

type ContextSwitches

type ContextSwitches struct {
	metric.Int64Counter
}

ContextSwitches is an instrument used to record metric values conforming to the "process.context_switches" semantic conventions. It represents the number of times the process has been context switched.

func NewContextSwitches

func NewContextSwitches(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (ContextSwitches, error)

NewContextSwitches returns a new ContextSwitches instrument.

func (ContextSwitches) Add

func (m ContextSwitches) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (ContextSwitches) AttrContextSwitchType

func (ContextSwitches) AttrContextSwitchType(val ContextSwitchTypeAttr) attribute.KeyValue

AttrContextSwitchType returns an optional attribute for the "process.context_switch_type" semantic convention. It represents the specifies whether the context switches for this data point were voluntary or involuntary.

func (ContextSwitches) Description

func (ContextSwitches) Description() string

Description returns the semantic convention description of the instrument

func (ContextSwitches) Inst

Inst returns the underlying metric instrument.

func (ContextSwitches) Name

func (ContextSwitches) Name() string

Name returns the semantic convention name of the instrument.

func (ContextSwitches) Unit

func (ContextSwitches) Unit() string

Unit returns the semantic convention unit of the instrument

type DiskIO

type DiskIO struct {
	metric.Int64Counter
}

DiskIO is an instrument used to record metric values conforming to the "process.disk.io" semantic conventions. It represents the disk bytes transferred.

func NewDiskIO

func NewDiskIO(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (DiskIO, error)

NewDiskIO returns a new DiskIO instrument.

func (DiskIO) Add

func (m DiskIO) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (DiskIO) AttrDiskIODirection

func (DiskIO) AttrDiskIODirection(val DiskIODirectionAttr) attribute.KeyValue

AttrDiskIODirection returns an optional attribute for the "disk.io.direction" semantic convention. It represents the disk IO operation direction.

func (DiskIO) Description

func (DiskIO) Description() string

Description returns the semantic convention description of the instrument

func (DiskIO) Inst

func (m DiskIO) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (DiskIO) Name

func (DiskIO) Name() string

Name returns the semantic convention name of the instrument.

func (DiskIO) Unit

func (DiskIO) Unit() string

Unit returns the semantic convention unit of the instrument

type DiskIODirectionAttr

type DiskIODirectionAttr string

DiskIODirectionAttr is an attribute conforming to the disk.io.direction semantic conventions. It represents the disk IO operation direction.

var (
	// DiskIODirectionRead is the none.
	DiskIODirectionRead DiskIODirectionAttr = "read"
	// DiskIODirectionWrite is the none.
	DiskIODirectionWrite DiskIODirectionAttr = "write"
)

type MemoryUsage

type MemoryUsage struct {
	metric.Int64UpDownCounter
}

MemoryUsage is an instrument used to record metric values conforming to the "process.memory.usage" semantic conventions. It represents the amount of physical memory in use.

func NewMemoryUsage

func NewMemoryUsage(
	m metric.Meter,
	opt ...metric.Int64UpDownCounterOption,
) (MemoryUsage, error)

NewMemoryUsage returns a new MemoryUsage instrument.

func (MemoryUsage) Add

func (m MemoryUsage) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)

Add adds incr to the existing count.

func (MemoryUsage) Description

func (MemoryUsage) Description() string

Description returns the semantic convention description of the instrument

func (MemoryUsage) Inst

Inst returns the underlying metric instrument.

func (MemoryUsage) Name

func (MemoryUsage) Name() string

Name returns the semantic convention name of the instrument.

func (MemoryUsage) Unit

func (MemoryUsage) Unit() string

Unit returns the semantic convention unit of the instrument

type MemoryVirtual

type MemoryVirtual struct {
	metric.Int64UpDownCounter
}

MemoryVirtual is an instrument used to record metric values conforming to the "process.memory.virtual" semantic conventions. It represents the amount of committed virtual memory.

func NewMemoryVirtual

func NewMemoryVirtual(
	m metric.Meter,
	opt ...metric.Int64UpDownCounterOption,
) (MemoryVirtual, error)

NewMemoryVirtual returns a new MemoryVirtual instrument.

func (MemoryVirtual) Add

func (m MemoryVirtual) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)

Add adds incr to the existing count.

func (MemoryVirtual) Description

func (MemoryVirtual) Description() string

Description returns the semantic convention description of the instrument

func (MemoryVirtual) Inst

Inst returns the underlying metric instrument.

func (MemoryVirtual) Name

func (MemoryVirtual) Name() string

Name returns the semantic convention name of the instrument.

func (MemoryVirtual) Unit

func (MemoryVirtual) Unit() string

Unit returns the semantic convention unit of the instrument

type NetworkIO

type NetworkIO struct {
	metric.Int64Counter
}

NetworkIO is an instrument used to record metric values conforming to the "process.network.io" semantic conventions. It represents the network bytes transferred.

func NewNetworkIO

func NewNetworkIO(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (NetworkIO, error)

NewNetworkIO returns a new NetworkIO instrument.

func (NetworkIO) Add

func (m NetworkIO) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (NetworkIO) AttrNetworkIODirection

func (NetworkIO) AttrNetworkIODirection(val NetworkIODirectionAttr) attribute.KeyValue

AttrNetworkIODirection returns an optional attribute for the "network.io.direction" semantic convention. It represents the network IO operation direction.

func (NetworkIO) Description

func (NetworkIO) Description() string

Description returns the semantic convention description of the instrument

func (NetworkIO) Inst

func (m NetworkIO) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (NetworkIO) Name

func (NetworkIO) Name() string

Name returns the semantic convention name of the instrument.

func (NetworkIO) Unit

func (NetworkIO) Unit() string

Unit returns the semantic convention unit of the instrument

type NetworkIODirectionAttr

type NetworkIODirectionAttr string

NetworkIODirectionAttr is an attribute conforming to the network.io.direction semantic conventions. It represents the network IO operation direction.

var (
	// NetworkIODirectionTransmit is the none.
	NetworkIODirectionTransmit NetworkIODirectionAttr = "transmit"
	// NetworkIODirectionReceive is the none.
	NetworkIODirectionReceive NetworkIODirectionAttr = "receive"
)

type OpenFileDescriptorCount

type OpenFileDescriptorCount struct {
	metric.Int64UpDownCounter
}

OpenFileDescriptorCount is an instrument used to record metric values conforming to the "process.open_file_descriptor.count" semantic conventions. It represents the number of file descriptors in use by the process.

func NewOpenFileDescriptorCount

func NewOpenFileDescriptorCount(
	m metric.Meter,
	opt ...metric.Int64UpDownCounterOption,
) (OpenFileDescriptorCount, error)

NewOpenFileDescriptorCount returns a new OpenFileDescriptorCount instrument.

func (OpenFileDescriptorCount) Add

func (m OpenFileDescriptorCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)

Add adds incr to the existing count.

func (OpenFileDescriptorCount) Description

func (OpenFileDescriptorCount) Description() string

Description returns the semantic convention description of the instrument

func (OpenFileDescriptorCount) Inst

Inst returns the underlying metric instrument.

func (OpenFileDescriptorCount) Name

Name returns the semantic convention name of the instrument.

func (OpenFileDescriptorCount) Unit

Unit returns the semantic convention unit of the instrument

type PagingFaultTypeAttr

type PagingFaultTypeAttr string

PagingFaultTypeAttr is an attribute conforming to the process.paging.fault_type semantic conventions. It represents the type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults.

var (
	// PagingFaultTypeMajor is the none.
	PagingFaultTypeMajor PagingFaultTypeAttr = "major"
	// PagingFaultTypeMinor is the none.
	PagingFaultTypeMinor PagingFaultTypeAttr = "minor"
)

type PagingFaults

type PagingFaults struct {
	metric.Int64Counter
}

PagingFaults is an instrument used to record metric values conforming to the "process.paging.faults" semantic conventions. It represents the number of page faults the process has made.

func NewPagingFaults

func NewPagingFaults(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (PagingFaults, error)

NewPagingFaults returns a new PagingFaults instrument.

func (PagingFaults) Add

func (m PagingFaults) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (PagingFaults) AttrPagingFaultType

func (PagingFaults) AttrPagingFaultType(val PagingFaultTypeAttr) attribute.KeyValue

AttrPagingFaultType returns an optional attribute for the "process.paging.fault_type" semantic convention. It represents the type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults.

func (PagingFaults) Description

func (PagingFaults) Description() string

Description returns the semantic convention description of the instrument

func (PagingFaults) Inst

func (m PagingFaults) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (PagingFaults) Name

func (PagingFaults) Name() string

Name returns the semantic convention name of the instrument.

func (PagingFaults) Unit

func (PagingFaults) Unit() string

Unit returns the semantic convention unit of the instrument

type ThreadCount

type ThreadCount struct {
	metric.Int64UpDownCounter
}

ThreadCount is an instrument used to record metric values conforming to the "process.thread.count" semantic conventions. It represents the process threads count.

func NewThreadCount

func NewThreadCount(
	m metric.Meter,
	opt ...metric.Int64UpDownCounterOption,
) (ThreadCount, error)

NewThreadCount returns a new ThreadCount instrument.

func (ThreadCount) Add

func (m ThreadCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)

Add adds incr to the existing count.

func (ThreadCount) Description

func (ThreadCount) Description() string

Description returns the semantic convention description of the instrument

func (ThreadCount) Inst

Inst returns the underlying metric instrument.

func (ThreadCount) Name

func (ThreadCount) Name() string

Name returns the semantic convention name of the instrument.

func (ThreadCount) Unit

func (ThreadCount) Unit() string

Unit returns the semantic convention unit of the instrument

type Uptime

type Uptime struct {
	metric.Float64Gauge
}

Uptime is an instrument used to record metric values conforming to the "process.uptime" semantic conventions. It represents the time the process has been running.

func NewUptime

func NewUptime(
	m metric.Meter,
	opt ...metric.Float64GaugeOption,
) (Uptime, error)

NewUptime returns a new Uptime instrument.

func (Uptime) Description

func (Uptime) Description() string

Description returns the semantic convention description of the instrument

func (Uptime) Inst

func (m Uptime) Inst() metric.Float64Gauge

Inst returns the underlying metric instrument.

func (Uptime) Name

func (Uptime) Name() string

Name returns the semantic convention name of the instrument.

func (Uptime) Record

func (m Uptime) Record(ctx context.Context, val float64, attrs ...attribute.KeyValue)

Record records val to the current distribution.

Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available. The actual accuracy would depend on the instrumentation and operating system.

func (Uptime) Unit

func (Uptime) 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
linux/amd64
Imports
5 packages
Last checked
40 minutes ago

Tools for package owners.