Sha256: be9ff74784845b91726557ca084eb053af21cfbb7752d9e96cf4f4d0612bdef4
Contents?: true
Size: 1.35 KB
Versions: 6
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module AwsSdk # The MessageAttributeSetter class provides methods for writing tracing information to # SNS / SQS messages. # # @example # OpenTelemetry.propagation.inject(context.params[:message_attributes], setter: MessageAttributeSetter) class MessageAttributeSetter 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 end # The MessageAttributeGetter class provides methods for getting tracing information from SQS message. # # @example # OpenTelemetry.propagation.extract(message.message_attributes, getter: MessageAttributeGetter) class MessageAttributeGetter def self.get(carrier, key) return carrier&.[](key)&.[]('string_value') if carrier&.[](key)&.[]('data_type') == 'String' end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems