The boto3sqs instrumentation prepends "otel." to all attributes it adds to SQS messages (relevant code:
|
# We use this prefix so we can request all instrumentation MessageAttributeNames with a wildcard, without harming |
|
# existing filters |
|
_OPENTELEMETRY_ATTRIBUTE_IDENTIFIER: str = "otel." |
|
_OTEL_IDENTIFIER_LENGTH = len(_OPENTELEMETRY_ATTRIBUTE_IDENTIFIER) |
|
|
|
|
|
class Boto3SQSGetter(Getter[CarrierT]): |
|
def get(self, carrier: CarrierT, key: str) -> Optional[List[str]]: |
|
value = carrier.get(f"{_OPENTELEMETRY_ATTRIBUTE_IDENTIFIER}{key}", {}) |
|
if not value: |
|
return None |
|
return [value.get("StringValue")] |
|
|
|
def keys(self, carrier: CarrierT) -> List[str]: |
|
return [ |
|
key[_OTEL_IDENTIFIER_LENGTH:] |
|
if key.startswith(_OPENTELEMETRY_ATTRIBUTE_IDENTIFIER) |
|
else key |
|
for key in carrier.keys() |
|
] |
|
|
|
|
|
class Boto3SQSSetter(Setter[CarrierT]): |
|
def set(self, carrier: CarrierT, key: str, value: str) -> None: |
|
# This is a limitation defined by AWS for SQS MessageAttributes size |
|
if len(carrier.items()) < 10: |
|
carrier[f"{_OPENTELEMETRY_ATTRIBUTE_IDENTIFIER}{key}"] = { |
). This will make it impossible to write a propagator that works with instrumentations (of OTel or other vendors) that don't use this prefix.
The reasons cited at https://www.oxeye.io/blog/diving-into-opentelemetrys-specs:
So I suggest to remove the otel. prefix and instead use TextMapPropagator.fields to ensure the required attributes are fetched.
CC @oxeye-nikolay
The boto3sqs instrumentation prepends "otel." to all attributes it adds to SQS messages (relevant code:
opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py
Lines 56 to 82 in 7c75b38
The reasons cited at https://www.oxeye.io/blog/diving-into-opentelemetrys-specs:
TextMapPropagator.fields, although it is meant for listing injected fields, these will usually be the same as extracted ones. This is also what Node.Js does: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/1db1fecc16ecb3dbad530de530418260e54c087a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts#L71-L75So I suggest to remove the
otel.prefix and instead useTextMapPropagator.fieldsto ensure the required attributes are fetched.CC @oxeye-nikolay