Documentation
¶
Index ¶
- func RecordAMQPConsumeMetrics(ctx context.Context, delivery *amqp.Delivery, queueName string, ...)
- func RecordAMQPPublishMetrics(ctx context.Context, exchange, routingKey string, duration time.Duration, ...)
- func RecordChannelEvent(eventType string, err error)
- func RecordConnectionEvent(eventType string, err error)
- func RecordPublishRetry(ctx context.Context, exchange, routingKey, reason string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecordAMQPConsumeMetrics ¶
func RecordAMQPConsumeMetrics(ctx context.Context, delivery *amqp.Delivery, queueName string, duration time.Duration, err error)
RecordAMQPConsumeMetrics records OpenTelemetry metrics for an AMQP consume operation. This function is called automatically when a message is consumed to emit metrics.
Metrics recorded: - messaging.client.operation.duration: Histogram of operation durations in seconds - messaging.client.consumed.messages: Counter of messages consumed
The function is non-blocking and handles errors gracefully.
func RecordAMQPPublishMetrics ¶
func RecordAMQPPublishMetrics(ctx context.Context, exchange, routingKey string, duration time.Duration, err error)
RecordAMQPPublishMetrics records OpenTelemetry metrics for an AMQP publish operation. This function is called after a publish attempt to emit metrics about the operation.
Parameters:
- ctx: Context for metrics recording
- exchange: The AMQP exchange name (empty string for default exchange)
- routingKey: The routing key used for message delivery
- duration: Time taken for the publish operation
- err: Error if the operation failed, nil if successful
Metrics recorded: - messaging.client.operation.duration: Histogram of operation durations in seconds - messaging.client.sent.messages: Counter of messages sent (incremented on success)
The function is non-blocking and handles errors gracefully - metric recording failures will not impact messaging operation execution.
func RecordChannelEvent ¶
RecordChannelEvent records AMQP channel lifecycle events. eventType should be "create" or "close".
func RecordConnectionEvent ¶
RecordConnectionEvent records AMQP connection lifecycle events. eventType should be "create" or "close".
func RecordPublishRetry ¶
RecordPublishRetry records a publish retry attempt in the retry counter. This is called each time a publish operation is retried due to NACK, timeout, or error.
Parameters:
- ctx: Context for metrics recording
- exchange: The AMQP exchange name (empty string for default exchange)
- routingKey: The routing key used for message delivery
- reason: The reason for the retry (e.g., "nack", "timeout", "publish_error")
Types ¶
This section is empty.