OpenTelemetry Boto3 SQS Instrumentation
This library allows tracing requests made by the Boto3 library to the SQS service.
Installation
pip install opentelemetry-instrumentation-boto3sqs
References
Instrument boto3sqs to trace SQS applications.
Usage
import boto3
from opentelemetry.instrumentation.boto3sqs import Boto3SQSInstrumentor
Boto3SQSInstrumentor().instrument()
—
- class opentelemetry.instrumentation.boto3sqs.Boto3SQSGetter(*args, **kwds)[source]
Bases:
Getter
[CarrierT
]
- class opentelemetry.instrumentation.boto3sqs.Boto3SQSSetter(*args, **kwds)[source]
Bases:
Setter
[CarrierT
]
- class opentelemetry.instrumentation.boto3sqs.Boto3SQSInstrumentor(*args, **kwargs)[source]
Bases:
BaseInstrumentor
- current_context_token = None
- class ContextableList(iterable=(), /)[source]
Bases:
list
Since the classic way to process SQS messages is using a for loop, without a well defined scope like a callback - we are doing something similar to the instrumentation of Kafka-python and instrumenting the __iter__ functions and the __getitem__ functions to set the span context of the addressed message. Since the return value from an SQS.ReceiveMessage returns a builtin list, we cannot wrap it and change all of the calls for list.__iter__ and list.__getitem__ - therefore we use ContextableList. It is bound to the received_messages_spans dict
- instrumentation_dependencies()[source]
Return a list of python packages with versions that the will be instrumented.
The format should be the same as used in requirements.txt or pyproject.toml.
For example, if an instrumentation instruments requests 1.x, this method should look like: :rtype:
Collection
[str
]- def instrumentation_dependencies(self) -> Collection[str]:
return [‘requests ~= 1.0’]
This will ensure that the instrumentation will only be used when the specified library is present in the environment.