Files
2020-11-20 16:02:09 -08:00

73 lines
1.8 KiB
ReStructuredText

OpenTelemetry SDK Extension for AWS X-Ray Compatibility
=======================================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-sdk-extension-aws.svg
:target: https://pypi.org/project/opentelemetry-sdk-extension-aws/
This library provides components necessary to configure the OpenTelemetry SDK
for tracing with AWS X-Ray.
Installation
------------
::
pip install opentelemetry-sdk-extension-aws
Usage (AWS X-Ray IDs Generator)
-------------------------------
Configure the OTel SDK TracerProvider with the provided custom IDs Generator to
make spans compatible with the AWS X-Ray backend tracing service.
Install the OpenTelemetry SDK package.
::
pip install opentelemetry-sdk
Next, use the provided `AwsXRayIdsGenerator` to initialize the `TracerProvider`.
.. code-block:: python
import opentelemetry.trace as trace
from opentelemetry.sdk.extension.aws.trace import AwsXRayIdsGenerator
from opentelemetry.sdk.trace import TracerProvider
trace.set_tracer_provider(
TracerProvider(ids_generator=AwsXRayIdsGenerator())
)
Usage (AWS X-Ray Propagator)
----------------------------
Use the provided AWS X-Ray Propagator to inject the necessary context into
traces sent to external systems.
This can be done by either setting this environment variable:
::
export OTEL_PROPAGATORS = aws_xray
Or by setting this propagator in your instrumented application:
.. code-block:: python
from opentelemetry import propagators
from opentelemetry.sdk.extension.aws.trace.propagation.aws_xray_format import AwsXRayFormat
propagators.set_global_textmap(AwsXRayFormat())
References
----------
* `OpenTelemetry Project <https://opentelemetry.io/>`_
* `AWS X-Ray Trace IDs Format <https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-traceids>`_