
Changes: - Update dbapi instrumentation to use the SQL statement name as the span instead of the entire SQL query. - Renamed TracedCursor with CursorTracing. The class was not a valid Cursor so the name was confusing. - Updated CursorTracing's (previously TracedCursor) traced_execution method to accept the cursor instance as the first argument. This is required as for some dbapi implementations, we need a reference to the cursor in order to correctly format the SQL query. - Updated psycopg2 instrumentation to leverage dbapi's `cursor_factory` mechanism instead of wrapping the cursor with wrapt. This results in a simpler instrumentation without monkey patching objects at runtime and allows psycopg2's type registration system to work. This should make it possible to use psycopg2 instrumentation when using the JSONB feature or with frameworks like Django.
opentelemetry-python-contrib
The Python auto-instrumentation libraries for OpenTelemetry (per OTEP 0001)
Installation
This repository includes installable packages for each instrumented library. 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.
Please note that these libraries are currently in beta, and shouldn't generally be used in production environments.
The
instrumentation/
directory includes OpenTelemetry instrumentation packages, which can be installed
separately as:
pip install opentelemetry-instrumentation-{integration}
To install the development versions of these packages instead, clone or fork this repo and do an editable install:
pip install -e ./instrumentation/opentelemetry-instrumentation-{integration}
Contributing
See CONTRIBUTING.md
We meet weekly on Thursday, and the time of the meeting alternates between 9AM PT and 4PM PT. The meeting is subject to change depending on contributors' availability. Check the OpenTelemetry community calendar for specific dates.
Meetings take place via Zoom video conference.
Meeting notes are available as a public Google doc. For edit access, get in touch on Gitter.
Approvers (@open-telemetry/python-approvers):
- Aaron Abbott, Google
- Diego Hurtado
- Hector Hernandez, Microsoft
- Owais Lone, Splunk
- Yusuke Tsutsumi, Google
Find more about the approver role in community repository.
Maintainers (@open-telemetry/python-maintainers):
- Alex Boten, Lightstep
- Leighton Chen, Microsoft
Find more about the maintainer role in community repository.
Running Tests Locally
- Go to your Contrib repo directory.
cd ~/git/opentelemetry-python-contrib
. - Create a virtual env in your Contrib repo directory.
python3 -m venv my_test_venv
. - Activate your virtual env.
source my_test_venv/bin/activate
. - Clone the OpenTelemetry Python Python Core repo to a folder named
opentelemetry-python-core
.git clone git@github.com:open-telemetry/opentelemetry-python.git opentelemetry-python-core
. - Change directory to the repo that was just cloned.
cd opentelemetry-python-core
. - Move the head of this repo to the hash you want your tests to use. This is currently the SHA
47483865854c7adae7455f8441dab7f814f4ce2a
as seen in.github/workflows/test.yml
. Usegit fetch && git checkout 47483865854c7adae7455f8441dab7f814f4ce2a
. - Go back to the root directory.
cd ../
. - Make sure you have
tox
installed.pip install tox
. - Run tests for a package. (e.g.
tox -e test-instrumentation-flask
.)