OpenTelemetry Python Contrib
repository·main·Indexed 22 days ago
https://github.com/open-telemetry/opentelemetry-python-contribA collection of auto-instrumentation libraries, exporters, and SDK extensions for various Python integrations. It provides telemetry for popular libraries following the OTEP 0001 standard, including GenAI instrumentations for OpenAI, Anthropic, and LangChain, as well as a Prometheus Remote Write Exporter. These libraries are currently in beta and are designed to collect traces and metrics without manual instrumentation.
What's inside opentelemetry-python-contrib
- The OpenTelemetry OpAMP (Open Agent Management Protocol) Client is an HTTP-based client designed for use within OpenTelemetry distributions. Its primary purpose is to enable remote configuration, allowing an OpAMP server to manage and update the configuration of OpenTelemetry agents/collectors dynamically.
Overview of OpenTelemetry Python Instrumentations
mainThe
opentelemetry-python-contribrepository provides various instrumentation packages to automatically collect traces and metrics from popular Python libraries.When choosing an instrumentation package, consider:
- Supported Packages: Ensure your version of the library falls within the supported range.
- Metrics Support: Some instrumentations only provide Traces, while others also provide Metrics (indicated by 'Yes' in the support table).
- Semantic Convention (Semconv) Status:
development: The instrumentation is actively being developed and semantic conventions may change.migration: The instrumentation is in a transition phase regarding semantic conventions.
Refer to the specific package documentation for installation and configuration details.
Use OpenTelemetry WSGI Middleware to track request timing
mainTheopentelemetry-instrumentation-wsgilibrary provides a middleware component compatible with any WSGI framework (e.g., Django, Flask). When integrated into your application's middleware stack, it automatically tracks the timing and lifecycle of incoming HTTP requests using OpenTelemetry.Use OpenTelemetry WSGI Instrumentation
mainTheopentelemetry.instrumentation.wsgimodule provides instrumentation for WSGI (Web Server Gateway Interface) applications. It allows you to automatically capture traces for incoming requests in any Python web application that follows the WSGI standard (such as Flask, Django, or Bottle) when they are served via a WSGI server.Use OpenTelemetry Redis Instrumentation to trace Redis requests
mainTheopentelemetry-instrumentation-redislibrary provides automatic or manual instrumentation to capture traces for operations performed using the Redis client library. This allows you to observe the latency and lifecycle of Redis commands within your distributed traces.Use OpenTelemetry Botocore Instrumentation
mainOpenTelemetry Botocore instrumentation allows you to automatically capture traces for AWS service calls made via thebotocorelibrary. This instrumentation tracks the lifecycle of AWS requests, providing visibility into outgoing calls to AWS services.Use OpenTelemetry Aio-pika Instrumentation
mainThis library provides instrumentation for theaio-pikalibrary, allowing you to trace asynchronous AMQP requests. For detailed API documentation and advanced usage, refer to the official instrumentation guide.Trace requests in botocore and aiobotocore
mainThis instrumentation library provides tracing capabilities for outgoing requests made via thebotocoreandaiobotocorelibraries, allowing you to observe AWS service interactions within your Python applications.Trace requests made by the pika library
mainTheopentelemetry-instrumentation-pikalibrary provides instrumentation for thepikalibrary, allowing you to capture traces for RabbitMQ interactions and requests made through pika.Trace Tortoise ORM queries
mainThe
opentelemetry-instrumentation-tortoiseormlibrary provides tracing capabilities for queries executed through Tortoise ORM backends. It currently supports the following database types:mysqlpostgressqlite
Use OpenTelemetry pymemcache Instrumentation
mainTheopentelemetry-instrumentation-pymemcachepackage provides automatic instrumentation for thepymemcacheclient. It allows you to capture traces for cache operations performed using thepymemcachelibrary, enabling visibility into cache hits, misses, and latency within your distributed tracing system.Use OpenTelemetry Starlette Instrumentation
mainThis library provides both automatic and manual instrumentation for Starlette applications. It instruments the HTTP requests served by the framework.
Automatic instrumentation is also supported using the
opentelemetry-instrumentationpackage.