tracking

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

func RecordChannelEvent(eventType string, err error)

RecordChannelEvent records AMQP channel lifecycle events. eventType should be "create" or "close".

func RecordConnectionEvent

func RecordConnectionEvent(eventType string, err error)

RecordConnectionEvent records AMQP connection lifecycle events. eventType should be "create" or "close".

func RecordPublishRetry

func RecordPublishRetry(ctx context.Context, exchange, routingKey, reason string)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL