Class: OpenTelemetry::Instrumentation::AwsSdk::MessageAttributeSetter

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/instrumentation/aws_sdk/message_attributes.rb

Overview

The MessageAttributeSetter class provides methods for writing tracing information to SNS / SQS messages.

Examples:

OpenTelemetry.propagation.inject(context.params[:message_attributes], setter: MessageAttributeSetter)

Class Method Summary collapse

Class Method Details

.set(carrier, key, value) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/opentelemetry/instrumentation/aws_sdk/message_attributes.rb', line 16

def self.set(carrier, key, value)
  # https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-quotas.html
  if carrier.length < 10
    carrier[key] = { string_value: value, data_type: 'String' }
  else
    OpenTelemetry.logger.warn('aws-sdk instrumentation: cannot set context propagation on SQS/SNS message due to maximum amount of MessageAttributes')
  end
end