Skip to main content

AWS SDK extension for OpenTelemetry

Project description

pypi

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 AwsXRayIdGenerator to initialize the TracerProvider.

import opentelemetry.trace as trace
from opentelemetry.sdk.extension.aws.trace import AwsXRayIdGenerator
from opentelemetry.sdk.trace import TracerProvider

trace.set_tracer_provider(
    TracerProvider(id_generator=AwsXRayIdGenerator())
)

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 = xray

Or by setting this propagator in your instrumented application:

from opentelemetry.propagate import set_global_textmap
from opentelemetry.sdk.extension.aws.trace.propagation.aws_xray_format import AwsXRayFormat

set_global_textmap(AwsXRayFormat())

Usage (AWS Resource Detectors)

Use the provided Resource Detectors to automatically populate attributes under the resource namespace of each generated span.

For example, if tracing with OpenTelemetry on an AWS EC2 instance, you can automatically populate resource attributes by creating a TraceProvider using the AwsEc2ResourceDetector:

import opentelemetry.trace as trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.extension.aws.resource.ec2 import (
    AwsEc2ResourceDetector,
)
from opentelemetry.sdk.resources import get_aggregated_resources

trace.set_tracer_provider(
    TracerProvider(
        resource=get_aggregated_resources(
            [
                AwsEc2ResourceDetector(),
            ]
        ),
    )
)

Refer to each detectors’ docstring to determine any possible requirements for that detector.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentelemetry-sdk-extension-aws-0.24b0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file opentelemetry-sdk-extension-aws-0.24b0.tar.gz.

File metadata

  • Download URL: opentelemetry-sdk-extension-aws-0.24b0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.11

File hashes

Hashes for opentelemetry-sdk-extension-aws-0.24b0.tar.gz
Algorithm Hash digest
SHA256 8e1e25beb330bfbea1e1fe2478c75d1d6ea21573a9f5e2bb41296c533a6e600e
MD5 d7a278a4b880c254594799171d97f9bc
BLAKE2b-256 af417cc931eaebeeedeb84897fa6d14cedaa38df339d4356010fd378b2e64a62

See more details on using hashes here.

File details

Details for the file opentelemetry_sdk_extension_aws-0.24b0-py3-none-any.whl.

File metadata

  • Download URL: opentelemetry_sdk_extension_aws-0.24b0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.11

File hashes

Hashes for opentelemetry_sdk_extension_aws-0.24b0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bc80c2f7d342faa06b38e066b61d9484321e37b1fa43f14c42034ed78536005
MD5 beccf9c847f2c974135071866e297c1b
BLAKE2b-256 e56c2d9c6a1ae5d34a3a45eeb93f727494f3de0f43de6db91fdd6c668c532524

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page