The Python OpenTelemetry client.
This repository includes multiple installable packages. The opentelemetry-api
package includes abstract classes and no-op implementations that comprise the OpenTelemetry API following
the
specification.
The opentelemetry-sdk
package is the reference implementation of the API.
Libraries that produce telemetry data should only depend on opentelemetry-api
,
and defer the choice of the SDK to the application developer. Applications may
depend on opentelemetry-sdk
or another package that implements the API.
To install the API and SDK packages, fork or clone this repo and do an
editable
install
via pip
:
pip install -e ./opentelemetry-api
pip install -e ./opentelemetry-sdk
The
ext/
directory includes OpenTelemetry integration packages, which can be installed
separately as:
pip install -e ./ext/opentelemetry-ext-{integration}
from opentelemetry import trace
from opentelemetry.context import Context
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace.export import ConsoleSpanExporter
from opentelemetry.sdk.trace.export import SimpleExportSpanProcessor
trace.set_preferred_tracer_implementation(lambda T: Tracer())
tracer = trace.tracer()
tracer.add_span_processor(
SimpleExportSpanProcessor(ConsoleSpanExporter())
)
with tracer.start_span('foo'):
with tracer.start_span('bar'):
with tracer.start_span('baz'):
print(Context)
See opentelemetry-example-app for a complete example.
See CONTRIBUTING.md
OpenTelemetry Python is under active development. Our goal is to release an alpha version of the library at the end of September 2019. This release isn't guaranteed to conform to a specific version of the specification, and future releases will not attempt to maintain backwards compatibility with the alpha release.
Component | Version | Target Date |
---|---|---|
Tracing API | Alpha | September 30 2019 |
Tracing SDK | Alpha | September 30 2019 |
Metrics API | Alpha | September 30 2019 |
Metrics SDK | Alpha | September 30 2019 |
Jaeger Trace Exporter | Alpha | Unknown |
Prometheus Metrics Exporter | Alpha | Unknown |
Context Propagation | Alpha | September 30 2019 |
OpenTracing Bridge | Alpha | Unknown |
OpenCensus Bridge | Alpha | Unknown |