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 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-2.0.2.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file opentelemetry_sdk_extension_aws-2.0.2.tar.gz.

File metadata

File hashes

Hashes for opentelemetry_sdk_extension_aws-2.0.2.tar.gz
Algorithm Hash digest
SHA256 9faa9bdf480d1c5c53151dabee75735c94dbde09e4762c68ff5c7bd4aa3408f3
MD5 8b501e56dbe0222354a5d149b64c2bad
BLAKE2b-256 858652a95a0128b5aeb9db76e3ee6f9aeb6f2417ad24da28747318cbdf11c43d

See more details on using hashes here.

File details

Details for the file opentelemetry_sdk_extension_aws-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_sdk_extension_aws-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6e4b9fec01a4a9cfeac5272ce5aae6bc80e080a6bae1e52098746f53a7b32d
MD5 e755c6aefdd2c186175a84ce56c9fbf5
BLAKE2b-256 2d6cc85409f89ebe33d0998391f6e68ae0f2353a8e526450aad8b177ed5a26d3

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