package rpcconv

import "go.opentelemetry.io/otel/semconv/v1.38.0/rpcconv"

Package rpcconv provides types and functionality for OpenTelemetry semantic conventions in the "rpc" namespace.

Index

Types

type ClientDuration

type ClientDuration struct {
	metric.Float64Histogram
}

ClientDuration is an instrument used to record metric values conforming to the "rpc.client.duration" semantic conventions. It represents the measures the duration of outbound RPC.

func NewClientDuration

func NewClientDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (ClientDuration, error)

NewClientDuration returns a new ClientDuration instrument.

func (ClientDuration) AttrErrorType

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

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes a class of error the operation ended with.

func (ClientDuration) AttrMethod

func (ClientDuration) AttrMethod(val string) attribute.KeyValue

AttrMethod returns an optional attribute for the "rpc.method" semantic convention. It represents the this is the logical name of the method from the RPC interface perspective.

func (ClientDuration) AttrNetworkProtocolName

func (ClientDuration) AttrNetworkProtocolName(val string) attribute.KeyValue

AttrNetworkProtocolName returns an optional attribute for the "network.protocol.name" semantic convention. It represents the OSI application layer or non-OSI equivalent.

func (ClientDuration) AttrNetworkProtocolVersion

func (ClientDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue

AttrNetworkProtocolVersion returns an optional attribute for the "network.protocol.version" semantic convention. It represents the actual version of the protocol used for network communication.

func (ClientDuration) AttrNetworkTransport

func (ClientDuration) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue

AttrNetworkTransport returns an optional attribute for the "network.transport" semantic convention. It represents the OSI transport layer or inter-process communication method.

func (ClientDuration) AttrServerPort

func (ClientDuration) AttrServerPort(val int) attribute.KeyValue

AttrServerPort returns an optional attribute for the "server.port" semantic convention. It represents the server port number.

func (ClientDuration) AttrService

func (ClientDuration) AttrService(val string) attribute.KeyValue

AttrService returns an optional attribute for the "rpc.service" semantic convention. It represents the full (logical) name of the service being called, including its package name, if applicable.

func (ClientDuration) Description

func (ClientDuration) Description() string

Description returns the semantic convention description of the instrument

func (ClientDuration) Inst

Inst returns the underlying metric instrument.

func (ClientDuration) Name

func (ClientDuration) Name() string

Name returns the semantic convention name of the instrument.

func (ClientDuration) Record

func (m ClientDuration) Record(
	ctx context.Context,
	val float64,
	system SystemAttr,
	serverAddress string,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution for attrs.

The system is the a string identifying the remoting system. See below for a list of well-known identifiers.

The serverAddress is the server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

All additional attrs passed are included in the recorded value.

While streaming RPCs may record this metric as start-of-batch to end-of-batch, it's hard to interpret in practice.

**Streaming**: N/A.

func (ClientDuration) RecordSet

func (m ClientDuration) RecordSet(ctx context.Context, val float64, set attribute.Set)

RecordSet records val to the current distribution for set.

While streaming RPCs may record this metric as start-of-batch to end-of-batch, it's hard to interpret in practice.

**Streaming**: N/A.

func (ClientDuration) Unit

func (ClientDuration) Unit() string

Unit returns the semantic convention unit of the instrument

type ClientRequestSize

type ClientRequestSize struct {
	metric.Int64Histogram
}

ClientRequestSize is an instrument used to record metric values conforming to the "rpc.client.request.size" semantic conventions. It represents the measures the size of RPC request messages (uncompressed).

func NewClientRequestSize

func NewClientRequestSize(
	m metric.Meter,
	opt ...metric.Int64HistogramOption,
) (ClientRequestSize, error)

NewClientRequestSize returns a new ClientRequestSize instrument.

func (ClientRequestSize) AttrErrorType

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes a class of error the operation ended with.

func (ClientRequestSize) AttrMethod

func (ClientRequestSize) AttrMethod(val string) attribute.KeyValue

AttrMethod returns an optional attribute for the "rpc.method" semantic convention. It represents the this is the logical name of the method from the RPC interface perspective.

func (ClientRequestSize) AttrNetworkProtocolName

func (ClientRequestSize) AttrNetworkProtocolName(val string) attribute.KeyValue

AttrNetworkProtocolName returns an optional attribute for the "network.protocol.name" semantic convention. It represents the OSI application layer or non-OSI equivalent.

func (ClientRequestSize) AttrNetworkProtocolVersion

func (ClientRequestSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue

AttrNetworkProtocolVersion returns an optional attribute for the "network.protocol.version" semantic convention. It represents the actual version of the protocol used for network communication.

func (ClientRequestSize) AttrNetworkTransport

func (ClientRequestSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue

AttrNetworkTransport returns an optional attribute for the "network.transport" semantic convention. It represents the OSI transport layer or inter-process communication method.

func (ClientRequestSize) AttrServerPort

func (ClientRequestSize) AttrServerPort(val int) attribute.KeyValue

AttrServerPort returns an optional attribute for the "server.port" semantic convention. It represents the server port number.

func (ClientRequestSize) AttrService

func (ClientRequestSize) AttrService(val string) attribute.KeyValue

AttrService returns an optional attribute for the "rpc.service" semantic convention. It represents the full (logical) name of the service being called, including its package name, if applicable.

func (ClientRequestSize) Description

func (ClientRequestSize) Description() string

Description returns the semantic convention description of the instrument

func (ClientRequestSize) Inst

Inst returns the underlying metric instrument.

func (ClientRequestSize) Name

func (ClientRequestSize) Name() string

Name returns the semantic convention name of the instrument.

func (ClientRequestSize) Record

func (m ClientRequestSize) Record(
	ctx context.Context,
	val int64,
	system SystemAttr,
	serverAddress string,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution for attrs.

The system is the a string identifying the remoting system. See below for a list of well-known identifiers.

The serverAddress is the server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

All additional attrs passed are included in the recorded value.

**Streaming**: Recorded per message in a streaming batch

func (ClientRequestSize) RecordSet

func (m ClientRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set)

RecordSet records val to the current distribution for set.

**Streaming**: Recorded per message in a streaming batch

func (ClientRequestSize) Unit

func (ClientRequestSize) Unit() string

Unit returns the semantic convention unit of the instrument

type ClientResponseSize

type ClientResponseSize struct {
	metric.Int64Histogram
}

ClientResponseSize is an instrument used to record metric values conforming to the "rpc.client.response.size" semantic conventions. It represents the measures the size of RPC response messages (uncompressed).

func NewClientResponseSize

func NewClientResponseSize(
	m metric.Meter,
	opt ...metric.Int64HistogramOption,
) (ClientResponseSize, error)

NewClientResponseSize returns a new ClientResponseSize instrument.

func (ClientResponseSize) AttrErrorType

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes a class of error the operation ended with.

func (ClientResponseSize) AttrMethod

func (ClientResponseSize) AttrMethod(val string) attribute.KeyValue

AttrMethod returns an optional attribute for the "rpc.method" semantic convention. It represents the this is the logical name of the method from the RPC interface perspective.

func (ClientResponseSize) AttrNetworkProtocolName

func (ClientResponseSize) AttrNetworkProtocolName(val string) attribute.KeyValue

AttrNetworkProtocolName returns an optional attribute for the "network.protocol.name" semantic convention. It represents the OSI application layer or non-OSI equivalent.

func (ClientResponseSize) AttrNetworkProtocolVersion

func (ClientResponseSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue

AttrNetworkProtocolVersion returns an optional attribute for the "network.protocol.version" semantic convention. It represents the actual version of the protocol used for network communication.

func (ClientResponseSize) AttrNetworkTransport

func (ClientResponseSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue

AttrNetworkTransport returns an optional attribute for the "network.transport" semantic convention. It represents the OSI transport layer or inter-process communication method.

func (ClientResponseSize) AttrServerPort

func (ClientResponseSize) AttrServerPort(val int) attribute.KeyValue

AttrServerPort returns an optional attribute for the "server.port" semantic convention. It represents the server port number.

func (ClientResponseSize) AttrService

func (ClientResponseSize) AttrService(val string) attribute.KeyValue

AttrService returns an optional attribute for the "rpc.service" semantic convention. It represents the full (logical) name of the service being called, including its package name, if applicable.

func (ClientResponseSize) Description

func (ClientResponseSize) Description() string

Description returns the semantic convention description of the instrument

func (ClientResponseSize) Inst

Inst returns the underlying metric instrument.

func (ClientResponseSize) Name

func (ClientResponseSize) Name() string

Name returns the semantic convention name of the instrument.

func (ClientResponseSize) Record

func (m ClientResponseSize) Record(
	ctx context.Context,
	val int64,
	system SystemAttr,
	serverAddress string,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution for attrs.

The system is the a string identifying the remoting system. See below for a list of well-known identifiers.

The serverAddress is the server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

All additional attrs passed are included in the recorded value.

**Streaming**: Recorded per response in a streaming batch

func (ClientResponseSize) RecordSet

func (m ClientResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set)

RecordSet records val to the current distribution for set.

**Streaming**: Recorded per response in a streaming batch

func (ClientResponseSize) Unit

func (ClientResponseSize) 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 describes a class of error the operation ended with.

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

type NetworkTransportAttr

type NetworkTransportAttr string

NetworkTransportAttr is an attribute conforming to the network.transport semantic conventions. It represents the OSI transport layer or inter-process communication method.

var (
	// NetworkTransportTCP is the TCP.
	NetworkTransportTCP NetworkTransportAttr = "tcp"
	// NetworkTransportUDP is the UDP.
	NetworkTransportUDP NetworkTransportAttr = "udp"
	// NetworkTransportPipe is the named or anonymous pipe.
	NetworkTransportPipe NetworkTransportAttr = "pipe"
	// NetworkTransportUnix is the unix domain socket.
	NetworkTransportUnix NetworkTransportAttr = "unix"
	// NetworkTransportQUIC is the QUIC.
	NetworkTransportQUIC NetworkTransportAttr = "quic"
)

type ServerDuration

type ServerDuration struct {
	metric.Float64Histogram
}

ServerDuration is an instrument used to record metric values conforming to the "rpc.server.duration" semantic conventions. It represents the measures the duration of inbound RPC.

func NewServerDuration

func NewServerDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (ServerDuration, error)

NewServerDuration returns a new ServerDuration instrument.

func (ServerDuration) AttrErrorType

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

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes a class of error the operation ended with.

func (ServerDuration) AttrMethod

func (ServerDuration) AttrMethod(val string) attribute.KeyValue

AttrMethod returns an optional attribute for the "rpc.method" semantic convention. It represents the this is the logical name of the method from the RPC interface perspective.

func (ServerDuration) AttrNetworkProtocolName

func (ServerDuration) AttrNetworkProtocolName(val string) attribute.KeyValue

AttrNetworkProtocolName returns an optional attribute for the "network.protocol.name" semantic convention. It represents the OSI application layer or non-OSI equivalent.

func (ServerDuration) AttrNetworkProtocolVersion

func (ServerDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue

AttrNetworkProtocolVersion returns an optional attribute for the "network.protocol.version" semantic convention. It represents the actual version of the protocol used for network communication.

func (ServerDuration) AttrNetworkTransport

func (ServerDuration) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue

AttrNetworkTransport returns an optional attribute for the "network.transport" semantic convention. It represents the OSI transport layer or inter-process communication method.

func (ServerDuration) AttrServerAddress

func (ServerDuration) AttrServerAddress(val string) attribute.KeyValue

AttrServerAddress returns an optional attribute for the "server.address" semantic convention. It represents the server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

func (ServerDuration) AttrServerPort

func (ServerDuration) AttrServerPort(val int) attribute.KeyValue

AttrServerPort returns an optional attribute for the "server.port" semantic convention. It represents the server port number.

func (ServerDuration) AttrService

func (ServerDuration) AttrService(val string) attribute.KeyValue

AttrService returns an optional attribute for the "rpc.service" semantic convention. It represents the full (logical) name of the service being called, including its package name, if applicable.

func (ServerDuration) Description

func (ServerDuration) Description() string

Description returns the semantic convention description of the instrument

func (ServerDuration) Inst

Inst returns the underlying metric instrument.

func (ServerDuration) Name

func (ServerDuration) Name() string

Name returns the semantic convention name of the instrument.

func (ServerDuration) Record

func (m ServerDuration) Record(
	ctx context.Context,
	val float64,
	system SystemAttr,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution for attrs.

The system is the a string identifying the remoting system. See below for a list of well-known identifiers.

All additional attrs passed are included in the recorded value.

While streaming RPCs may record this metric as start-of-batch to end-of-batch, it's hard to interpret in practice.

**Streaming**: N/A.

func (ServerDuration) RecordSet

func (m ServerDuration) RecordSet(ctx context.Context, val float64, set attribute.Set)

RecordSet records val to the current distribution for set.

While streaming RPCs may record this metric as start-of-batch to end-of-batch, it's hard to interpret in practice.

**Streaming**: N/A.

func (ServerDuration) Unit

func (ServerDuration) Unit() string

Unit returns the semantic convention unit of the instrument

type ServerRequestSize

type ServerRequestSize struct {
	metric.Int64Histogram
}

ServerRequestSize is an instrument used to record metric values conforming to the "rpc.server.request.size" semantic conventions. It represents the measures the size of RPC request messages (uncompressed).

func NewServerRequestSize

func NewServerRequestSize(
	m metric.Meter,
	opt ...metric.Int64HistogramOption,
) (ServerRequestSize, error)

NewServerRequestSize returns a new ServerRequestSize instrument.

func (ServerRequestSize) AttrErrorType

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes a class of error the operation ended with.

func (ServerRequestSize) AttrMethod

func (ServerRequestSize) AttrMethod(val string) attribute.KeyValue

AttrMethod returns an optional attribute for the "rpc.method" semantic convention. It represents the this is the logical name of the method from the RPC interface perspective.

func (ServerRequestSize) AttrNetworkProtocolName

func (ServerRequestSize) AttrNetworkProtocolName(val string) attribute.KeyValue

AttrNetworkProtocolName returns an optional attribute for the "network.protocol.name" semantic convention. It represents the OSI application layer or non-OSI equivalent.

func (ServerRequestSize) AttrNetworkProtocolVersion

func (ServerRequestSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue

AttrNetworkProtocolVersion returns an optional attribute for the "network.protocol.version" semantic convention. It represents the actual version of the protocol used for network communication.

func (ServerRequestSize) AttrNetworkTransport

func (ServerRequestSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue

AttrNetworkTransport returns an optional attribute for the "network.transport" semantic convention. It represents the OSI transport layer or inter-process communication method.

func (ServerRequestSize) AttrServerAddress

func (ServerRequestSize) AttrServerAddress(val string) attribute.KeyValue

AttrServerAddress returns an optional attribute for the "server.address" semantic convention. It represents the server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

func (ServerRequestSize) AttrServerPort

func (ServerRequestSize) AttrServerPort(val int) attribute.KeyValue

AttrServerPort returns an optional attribute for the "server.port" semantic convention. It represents the server port number.

func (ServerRequestSize) AttrService

func (ServerRequestSize) AttrService(val string) attribute.KeyValue

AttrService returns an optional attribute for the "rpc.service" semantic convention. It represents the full (logical) name of the service being called, including its package name, if applicable.

func (ServerRequestSize) Description

func (ServerRequestSize) Description() string

Description returns the semantic convention description of the instrument

func (ServerRequestSize) Inst

Inst returns the underlying metric instrument.

func (ServerRequestSize) Name

func (ServerRequestSize) Name() string

Name returns the semantic convention name of the instrument.

func (ServerRequestSize) Record

func (m ServerRequestSize) Record(
	ctx context.Context,
	val int64,
	system SystemAttr,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution for attrs.

The system is the a string identifying the remoting system. See below for a list of well-known identifiers.

All additional attrs passed are included in the recorded value.

**Streaming**: Recorded per message in a streaming batch

func (ServerRequestSize) RecordSet

func (m ServerRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set)

RecordSet records val to the current distribution for set.

**Streaming**: Recorded per message in a streaming batch

func (ServerRequestSize) Unit

func (ServerRequestSize) Unit() string

Unit returns the semantic convention unit of the instrument

type ServerResponseSize

type ServerResponseSize struct {
	metric.Int64Histogram
}

ServerResponseSize is an instrument used to record metric values conforming to the "rpc.server.response.size" semantic conventions. It represents the measures the size of RPC response messages (uncompressed).

func NewServerResponseSize

func NewServerResponseSize(
	m metric.Meter,
	opt ...metric.Int64HistogramOption,
) (ServerResponseSize, error)

NewServerResponseSize returns a new ServerResponseSize instrument.

func (ServerResponseSize) AttrErrorType

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes a class of error the operation ended with.

func (ServerResponseSize) AttrMethod

func (ServerResponseSize) AttrMethod(val string) attribute.KeyValue

AttrMethod returns an optional attribute for the "rpc.method" semantic convention. It represents the this is the logical name of the method from the RPC interface perspective.

func (ServerResponseSize) AttrNetworkProtocolName

func (ServerResponseSize) AttrNetworkProtocolName(val string) attribute.KeyValue

AttrNetworkProtocolName returns an optional attribute for the "network.protocol.name" semantic convention. It represents the OSI application layer or non-OSI equivalent.

func (ServerResponseSize) AttrNetworkProtocolVersion

func (ServerResponseSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue

AttrNetworkProtocolVersion returns an optional attribute for the "network.protocol.version" semantic convention. It represents the actual version of the protocol used for network communication.

func (ServerResponseSize) AttrNetworkTransport

func (ServerResponseSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue

AttrNetworkTransport returns an optional attribute for the "network.transport" semantic convention. It represents the OSI transport layer or inter-process communication method.

func (ServerResponseSize) AttrServerAddress

func (ServerResponseSize) AttrServerAddress(val string) attribute.KeyValue

AttrServerAddress returns an optional attribute for the "server.address" semantic convention. It represents the server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

func (ServerResponseSize) AttrServerPort

func (ServerResponseSize) AttrServerPort(val int) attribute.KeyValue

AttrServerPort returns an optional attribute for the "server.port" semantic convention. It represents the server port number.

func (ServerResponseSize) AttrService

func (ServerResponseSize) AttrService(val string) attribute.KeyValue

AttrService returns an optional attribute for the "rpc.service" semantic convention. It represents the full (logical) name of the service being called, including its package name, if applicable.

func (ServerResponseSize) Description

func (ServerResponseSize) Description() string

Description returns the semantic convention description of the instrument

func (ServerResponseSize) Inst

Inst returns the underlying metric instrument.

func (ServerResponseSize) Name

func (ServerResponseSize) Name() string

Name returns the semantic convention name of the instrument.

func (ServerResponseSize) Record

func (m ServerResponseSize) Record(
	ctx context.Context,
	val int64,
	system SystemAttr,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution for attrs.

The system is the a string identifying the remoting system. See below for a list of well-known identifiers.

All additional attrs passed are included in the recorded value.

**Streaming**: Recorded per response in a streaming batch

func (ServerResponseSize) RecordSet

func (m ServerResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set)

RecordSet records val to the current distribution for set.

**Streaming**: Recorded per response in a streaming batch

func (ServerResponseSize) Unit

func (ServerResponseSize) Unit() string

Unit returns the semantic convention unit of the instrument

type SystemAttr

type SystemAttr string

SystemAttr is an attribute conforming to the rpc.system semantic conventions. It represents a string identifying the remoting system. See below for a list of well-known identifiers.

var (
	// SystemGRPC is the gRPC.
	SystemGRPC SystemAttr = "grpc"
	// SystemJavaRmi is the java RMI.
	SystemJavaRmi SystemAttr = "java_rmi"
	// SystemDotnetWcf is the NET WCF.
	SystemDotnetWcf SystemAttr = "dotnet_wcf"
	// SystemApacheDubbo is the apache Dubbo.
	SystemApacheDubbo SystemAttr = "apache_dubbo"
	// SystemConnectRPC is the connect RPC.
	SystemConnectRPC SystemAttr = "connect_rpc"
	// SystemOncRPC is the [ONC RPC (Sun RPC)].
	//
	// [ONC RPC (Sun RPC)]: https://datatracker.ietf.org/doc/html/rfc5531
	SystemOncRPC SystemAttr = "onc_rpc"
	// SystemJSONRPC is the JSON-RPC.
	SystemJSONRPC SystemAttr = "jsonrpc"
)

Source Files

metric.go

Version
v1.43.0 (latest)
Published
Apr 3, 2026
Platform
linux/amd64
Imports
5 packages
Last checked
3 hours ago

Tools for package owners.