package messagingconv

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

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

Index

Types

type ClientConsumedMessages

type ClientConsumedMessages struct {
	metric.Int64Counter
}

ClientConsumedMessages is an instrument used to record metric values conforming to the "messaging.client.consumed.messages" semantic conventions. It represents the number of messages that were delivered to the application.

func NewClientConsumedMessages

func NewClientConsumedMessages(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (ClientConsumedMessages, error)

NewClientConsumedMessages returns a new ClientConsumedMessages instrument.

func (ClientConsumedMessages) Add

func (m ClientConsumedMessages) Add(
	ctx context.Context,
	incr int64,
	operationName string,
	system SystemAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The operationName is the the system-specific name of the messaging operation.

The system is the the messaging system as identified by the client instrumentation.

All additional attrs passed are included in the recorded value.

Records the number of messages pulled from the broker or number of messages dispatched to the application in push-based scenarios. The metric SHOULD be reported once per message delivery. For example, if receiving and processing operations are both instrumented for a single message delivery, this counter is incremented when the message is received and not reported when it is processed.

func (ClientConsumedMessages) AttrConsumerGroupName

func (ClientConsumedMessages) AttrConsumerGroupName(val string) attribute.KeyValue

AttrConsumerGroupName returns an optional attribute for the "messaging.consumer.group.name" semantic convention. It represents the name of the consumer group with which a consumer is associated.

func (ClientConsumedMessages) AttrDestinationName

func (ClientConsumedMessages) AttrDestinationName(val string) attribute.KeyValue

AttrDestinationName returns an optional attribute for the "messaging.destination.name" semantic convention. It represents the message destination name.

func (ClientConsumedMessages) AttrDestinationPartitionID

func (ClientConsumedMessages) AttrDestinationPartitionID(val string) attribute.KeyValue

AttrDestinationPartitionID returns an optional attribute for the "messaging.destination.partition.id" semantic convention. It represents the identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.

func (ClientConsumedMessages) AttrDestinationSubscriptionName

func (ClientConsumedMessages) AttrDestinationSubscriptionName(val string) attribute.KeyValue

AttrDestinationSubscriptionName returns an optional attribute for the "messaging.destination.subscription.name" semantic convention. It represents the name of the destination subscription from which a message is consumed.

func (ClientConsumedMessages) AttrDestinationTemplate

func (ClientConsumedMessages) AttrDestinationTemplate(val string) attribute.KeyValue

AttrDestinationTemplate returns an optional attribute for the "messaging.destination.template" semantic convention. It represents the low cardinality representation of the messaging destination name.

func (ClientConsumedMessages) 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 (ClientConsumedMessages) AttrServerAddress

func (ClientConsumedMessages) 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 (ClientConsumedMessages) AttrServerPort

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

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

func (ClientConsumedMessages) Description

func (ClientConsumedMessages) Description() string

Description returns the semantic convention description of the instrument

func (ClientConsumedMessages) Inst

Inst returns the underlying metric instrument.

func (ClientConsumedMessages) Name

Name returns the semantic convention name of the instrument.

func (ClientConsumedMessages) Unit

Unit returns the semantic convention unit of the instrument

type ClientOperationDuration

type ClientOperationDuration struct {
	metric.Float64Histogram
}

ClientOperationDuration is an instrument used to record metric values conforming to the "messaging.client.operation.duration" semantic conventions. It represents the duration of messaging operation initiated by a producer or consumer client.

func NewClientOperationDuration

func NewClientOperationDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (ClientOperationDuration, error)

NewClientOperationDuration returns a new ClientOperationDuration instrument.

func (ClientOperationDuration) AttrConsumerGroupName

func (ClientOperationDuration) AttrConsumerGroupName(val string) attribute.KeyValue

AttrConsumerGroupName returns an optional attribute for the "messaging.consumer.group.name" semantic convention. It represents the name of the consumer group with which a consumer is associated.

func (ClientOperationDuration) AttrDestinationName

func (ClientOperationDuration) AttrDestinationName(val string) attribute.KeyValue

AttrDestinationName returns an optional attribute for the "messaging.destination.name" semantic convention. It represents the message destination name.

func (ClientOperationDuration) AttrDestinationPartitionID

func (ClientOperationDuration) AttrDestinationPartitionID(val string) attribute.KeyValue

AttrDestinationPartitionID returns an optional attribute for the "messaging.destination.partition.id" semantic convention. It represents the identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.

func (ClientOperationDuration) AttrDestinationSubscriptionName

func (ClientOperationDuration) AttrDestinationSubscriptionName(val string) attribute.KeyValue

AttrDestinationSubscriptionName returns an optional attribute for the "messaging.destination.subscription.name" semantic convention. It represents the name of the destination subscription from which a message is consumed.

func (ClientOperationDuration) AttrDestinationTemplate

func (ClientOperationDuration) AttrDestinationTemplate(val string) attribute.KeyValue

AttrDestinationTemplate returns an optional attribute for the "messaging.destination.template" semantic convention. It represents the low cardinality representation of the messaging destination name.

func (ClientOperationDuration) 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 (ClientOperationDuration) AttrOperationType

AttrOperationType returns an optional attribute for the "messaging.operation.type" semantic convention. It represents a string identifying the type of the messaging operation.

func (ClientOperationDuration) AttrServerAddress

func (ClientOperationDuration) 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 (ClientOperationDuration) AttrServerPort

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

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

func (ClientOperationDuration) Description

func (ClientOperationDuration) Description() string

Description returns the semantic convention description of the instrument

func (ClientOperationDuration) Inst

Inst returns the underlying metric instrument.

func (ClientOperationDuration) Name

Name returns the semantic convention name of the instrument.

func (ClientOperationDuration) Record

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

Record records val to the current distribution.

The operationName is the the system-specific name of the messaging operation.

The system is the the messaging system as identified by the client instrumentation.

All additional attrs passed are included in the recorded value.

This metric SHOULD NOT be used to report processing duration - processing duration is reported in `messaging.process.duration` metric.

func (ClientOperationDuration) Unit

Unit returns the semantic convention unit of the instrument

type ClientSentMessages

type ClientSentMessages struct {
	metric.Int64Counter
}

ClientSentMessages is an instrument used to record metric values conforming to the "messaging.client.sent.messages" semantic conventions. It represents the number of messages producer attempted to send to the broker.

func NewClientSentMessages

func NewClientSentMessages(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (ClientSentMessages, error)

NewClientSentMessages returns a new ClientSentMessages instrument.

func (ClientSentMessages) Add

func (m ClientSentMessages) Add(
	ctx context.Context,
	incr int64,
	operationName string,
	system SystemAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The operationName is the the system-specific name of the messaging operation.

The system is the the messaging system as identified by the client instrumentation.

All additional attrs passed are included in the recorded value.

This metric MUST NOT count messages that were created but haven't yet been sent.

func (ClientSentMessages) AttrDestinationName

func (ClientSentMessages) AttrDestinationName(val string) attribute.KeyValue

AttrDestinationName returns an optional attribute for the "messaging.destination.name" semantic convention. It represents the message destination name.

func (ClientSentMessages) AttrDestinationPartitionID

func (ClientSentMessages) AttrDestinationPartitionID(val string) attribute.KeyValue

AttrDestinationPartitionID returns an optional attribute for the "messaging.destination.partition.id" semantic convention. It represents the identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.

func (ClientSentMessages) AttrDestinationTemplate

func (ClientSentMessages) AttrDestinationTemplate(val string) attribute.KeyValue

AttrDestinationTemplate returns an optional attribute for the "messaging.destination.template" semantic convention. It represents the low cardinality representation of the messaging destination name.

func (ClientSentMessages) 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 (ClientSentMessages) AttrServerAddress

func (ClientSentMessages) 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 (ClientSentMessages) AttrServerPort

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

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

func (ClientSentMessages) Description

func (ClientSentMessages) Description() string

Description returns the semantic convention description of the instrument

func (ClientSentMessages) Inst

Inst returns the underlying metric instrument.

func (ClientSentMessages) Name

func (ClientSentMessages) Name() string

Name returns the semantic convention name of the instrument.

func (ClientSentMessages) Unit

func (ClientSentMessages) 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 OperationTypeAttr

type OperationTypeAttr string

OperationTypeAttr is an attribute conforming to the messaging.operation.type semantic conventions. It represents a string identifying the type of the messaging operation.

var (
	// OperationTypeCreate is a message is created. "Create" spans always refer to a
	// single message and are used to provide a unique creation context for messages
	// in batch sending scenarios.
	OperationTypeCreate OperationTypeAttr = "create"
	// OperationTypeSend is the one or more messages are provided for sending to an
	// intermediary. If a single message is sent, the context of the "Send" span can
	// be used as the creation context and no "Create" span needs to be created.
	OperationTypeSend OperationTypeAttr = "send"
	// OperationTypeReceive is the one or more messages are requested by a consumer.
	// This operation refers to pull-based scenarios, where consumers explicitly
	// call methods of messaging SDKs to receive messages.
	OperationTypeReceive OperationTypeAttr = "receive"
	// OperationTypeProcess is the one or more messages are processed by a consumer.
	OperationTypeProcess OperationTypeAttr = "process"
	// OperationTypeSettle is the one or more messages are settled.
	OperationTypeSettle OperationTypeAttr = "settle"
)

type ProcessDuration

type ProcessDuration struct {
	metric.Float64Histogram
}

ProcessDuration is an instrument used to record metric values conforming to the "messaging.process.duration" semantic conventions. It represents the duration of processing operation.

func NewProcessDuration

func NewProcessDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (ProcessDuration, error)

NewProcessDuration returns a new ProcessDuration instrument.

func (ProcessDuration) AttrConsumerGroupName

func (ProcessDuration) AttrConsumerGroupName(val string) attribute.KeyValue

AttrConsumerGroupName returns an optional attribute for the "messaging.consumer.group.name" semantic convention. It represents the name of the consumer group with which a consumer is associated.

func (ProcessDuration) AttrDestinationName

func (ProcessDuration) AttrDestinationName(val string) attribute.KeyValue

AttrDestinationName returns an optional attribute for the "messaging.destination.name" semantic convention. It represents the message destination name.

func (ProcessDuration) AttrDestinationPartitionID

func (ProcessDuration) AttrDestinationPartitionID(val string) attribute.KeyValue

AttrDestinationPartitionID returns an optional attribute for the "messaging.destination.partition.id" semantic convention. It represents the identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.

func (ProcessDuration) AttrDestinationSubscriptionName

func (ProcessDuration) AttrDestinationSubscriptionName(val string) attribute.KeyValue

AttrDestinationSubscriptionName returns an optional attribute for the "messaging.destination.subscription.name" semantic convention. It represents the name of the destination subscription from which a message is consumed.

func (ProcessDuration) AttrDestinationTemplate

func (ProcessDuration) AttrDestinationTemplate(val string) attribute.KeyValue

AttrDestinationTemplate returns an optional attribute for the "messaging.destination.template" semantic convention. It represents the low cardinality representation of the messaging destination name.

func (ProcessDuration) AttrErrorType

func (ProcessDuration) 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 (ProcessDuration) AttrServerAddress

func (ProcessDuration) 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 (ProcessDuration) AttrServerPort

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

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

func (ProcessDuration) Description

func (ProcessDuration) Description() string

Description returns the semantic convention description of the instrument

func (ProcessDuration) Inst

Inst returns the underlying metric instrument.

func (ProcessDuration) Name

func (ProcessDuration) Name() string

Name returns the semantic convention name of the instrument.

func (ProcessDuration) Record

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

Record records val to the current distribution.

The operationName is the the system-specific name of the messaging operation.

The system is the the messaging system as identified by the client instrumentation.

All additional attrs passed are included in the recorded value.

This metric MUST be reported for operations with `messaging.operation.type` that matches `process`.

func (ProcessDuration) Unit

func (ProcessDuration) Unit() string

Unit returns the semantic convention unit of the instrument

type SystemAttr

type SystemAttr string

SystemAttr is an attribute conforming to the messaging.system semantic conventions. It represents the messaging system as identified by the client instrumentation.

var (
	// SystemActiveMQ is the apache ActiveMQ.
	SystemActiveMQ SystemAttr = "activemq"
	// SystemAWSSQS is the amazon Simple Queue Service (SQS).
	SystemAWSSQS SystemAttr = "aws_sqs"
	// SystemEventGrid is the azure Event Grid.
	SystemEventGrid SystemAttr = "eventgrid"
	// SystemEventHubs is the azure Event Hubs.
	SystemEventHubs SystemAttr = "eventhubs"
	// SystemServiceBus is the azure Service Bus.
	SystemServiceBus SystemAttr = "servicebus"
	// SystemGCPPubSub is the google Cloud Pub/Sub.
	SystemGCPPubSub SystemAttr = "gcp_pubsub"
	// SystemJMS is the java Message Service.
	SystemJMS SystemAttr = "jms"
	// SystemKafka is the apache Kafka.
	SystemKafka SystemAttr = "kafka"
	// SystemRabbitMQ is the rabbitMQ.
	SystemRabbitMQ SystemAttr = "rabbitmq"
	// SystemRocketMQ is the apache RocketMQ.
	SystemRocketMQ SystemAttr = "rocketmq"
	// SystemPulsar is the apache Pulsar.
	SystemPulsar SystemAttr = "pulsar"
)

Source Files

metric.go

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

Tools for package owners.