diff --git a/.github/workflows/core_contrib_test_0.yml b/.github/workflows/core_contrib_test_0.yml new file mode 100644 index 0000000000..67bda629ff --- /dev/null +++ b/.github/workflows/core_contrib_test_0.yml @@ -0,0 +1,1934 @@ +# Do not edit this file. +# This file is generated automatically by executing tox -e generate-workflows + +name: Core Contrib Test 0 + +on: + workflow_call: + inputs: + CORE_REPO_SHA: + required: true + type: string + CONTRIB_REPO_SHA: + required: true + type: string +env: + CORE_REPO_SHA: ${{ inputs.CORE_REPO_SHA }} + CONTRIB_REPO_SHA: ${{ inputs.CONTRIB_REPO_SHA }} + PIP_EXISTS_ACTION: w + +jobs: + + py38-test-instrumentation-openai-v2-0: + name: instrumentation-openai-v2-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-openai-v2-0 -- -ra + + py38-test-instrumentation-openai-v2-1: + name: instrumentation-openai-v2-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-openai-v2-1 -- -ra + + py38-test-resource-detector-container: + name: resource-detector-container + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-resource-detector-container -- -ra + + py38-test-resource-detector-azure-0: + name: resource-detector-azure-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-resource-detector-azure-0 -- -ra + + py38-test-resource-detector-azure-1: + name: resource-detector-azure-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-resource-detector-azure-1 -- -ra + + py38-test-sdk-extension-aws-0: + name: sdk-extension-aws-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-sdk-extension-aws-0 -- -ra + + py38-test-sdk-extension-aws-1: + name: sdk-extension-aws-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-sdk-extension-aws-1 -- -ra + + py38-test-distro: + name: distro + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-distro -- -ra + + py38-test-opentelemetry-instrumentation: + name: opentelemetry-instrumentation + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-opentelemetry-instrumentation -- -ra + + py38-test-instrumentation-aiohttp-client: + name: instrumentation-aiohttp-client + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aiohttp-client -- -ra + + py38-test-instrumentation-aiohttp-server: + name: instrumentation-aiohttp-server + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aiohttp-server -- -ra + + py38-test-instrumentation-aiopg: + name: instrumentation-aiopg + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aiopg -- -ra + + py38-test-instrumentation-aws-lambda: + name: instrumentation-aws-lambda + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aws-lambda -- -ra + + py38-test-instrumentation-botocore: + name: instrumentation-botocore + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-botocore -- -ra + + py38-test-instrumentation-boto3sqs: + name: instrumentation-boto3sqs + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-boto3sqs -- -ra + + py38-test-instrumentation-django-0: + name: instrumentation-django-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-django-0 -- -ra + + py38-test-instrumentation-django-1: + name: instrumentation-django-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-django-1 -- -ra + + py38-test-instrumentation-django-2: + name: instrumentation-django-2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-django-2 -- -ra + + py38-test-instrumentation-dbapi: + name: instrumentation-dbapi + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-dbapi -- -ra + + py38-test-instrumentation-boto: + name: instrumentation-boto + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-boto -- -ra + + py38-test-instrumentation-click: + name: instrumentation-click + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-click -- -ra + + py38-test-instrumentation-elasticsearch-0: + name: instrumentation-elasticsearch-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-elasticsearch-0 -- -ra + + py38-test-instrumentation-elasticsearch-1: + name: instrumentation-elasticsearch-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-elasticsearch-1 -- -ra + + py38-test-instrumentation-elasticsearch-2: + name: instrumentation-elasticsearch-2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-elasticsearch-2 -- -ra + + py38-test-instrumentation-falcon-0: + name: instrumentation-falcon-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-falcon-0 -- -ra + + py38-test-instrumentation-falcon-1: + name: instrumentation-falcon-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-falcon-1 -- -ra + + py38-test-instrumentation-falcon-2: + name: instrumentation-falcon-2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-falcon-2 -- -ra + + py38-test-instrumentation-fastapi: + name: instrumentation-fastapi + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-fastapi -- -ra + + py38-test-instrumentation-flask-0: + name: instrumentation-flask-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-flask-0 -- -ra + + py38-test-instrumentation-flask-1: + name: instrumentation-flask-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-flask-1 -- -ra + + py38-test-instrumentation-flask-2: + name: instrumentation-flask-2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-flask-2 -- -ra + + py38-test-instrumentation-urllib: + name: instrumentation-urllib + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-urllib -- -ra + + py38-test-instrumentation-urllib3-0: + name: instrumentation-urllib3-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-urllib3-0 -- -ra + + py38-test-instrumentation-urllib3-1: + name: instrumentation-urllib3-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-urllib3-1 -- -ra + + py38-test-instrumentation-requests: + name: instrumentation-requests + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-requests -- -ra + + py38-test-instrumentation-starlette: + name: instrumentation-starlette + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-starlette -- -ra + + py38-test-instrumentation-jinja2: + name: instrumentation-jinja2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-jinja2 -- -ra + + py38-test-instrumentation-logging: + name: instrumentation-logging + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-logging -- -ra + + py38-test-exporter-richconsole: + name: exporter-richconsole + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-exporter-richconsole -- -ra + + py38-test-exporter-prometheus-remote-write: + name: exporter-prometheus-remote-write + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-exporter-prometheus-remote-write -- -ra + + py38-test-instrumentation-mysql-0: + name: instrumentation-mysql-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-mysql-0 -- -ra + + py38-test-instrumentation-mysql-1: + name: instrumentation-mysql-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-mysql-1 -- -ra + + py38-test-instrumentation-mysqlclient: + name: instrumentation-mysqlclient + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-mysqlclient -- -ra + + py38-test-instrumentation-psycopg2: + name: instrumentation-psycopg2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-psycopg2 -- -ra + + py38-test-instrumentation-psycopg: + name: instrumentation-psycopg + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-psycopg -- -ra + + py38-test-instrumentation-pymemcache-0: + name: instrumentation-pymemcache-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pymemcache-0 -- -ra + + py38-test-instrumentation-pymemcache-1: + name: instrumentation-pymemcache-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pymemcache-1 -- -ra + + py38-test-instrumentation-pymemcache-2: + name: instrumentation-pymemcache-2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pymemcache-2 -- -ra + + py38-test-instrumentation-pymemcache-3: + name: instrumentation-pymemcache-3 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pymemcache-3 -- -ra + + py38-test-instrumentation-pymemcache-4: + name: instrumentation-pymemcache-4 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pymemcache-4 -- -ra + + py38-test-instrumentation-pymongo: + name: instrumentation-pymongo + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pymongo -- -ra + + py38-test-instrumentation-pymysql: + name: instrumentation-pymysql + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pymysql -- -ra + + py38-test-instrumentation-pyramid: + name: instrumentation-pyramid + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-pyramid -- -ra + + py38-test-instrumentation-asgi: + name: instrumentation-asgi + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-asgi -- -ra + + py38-test-instrumentation-asyncpg: + name: instrumentation-asyncpg + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-asyncpg -- -ra + + py38-test-instrumentation-sqlite3: + name: instrumentation-sqlite3 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-sqlite3 -- -ra + + py38-test-instrumentation-wsgi: + name: instrumentation-wsgi + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-wsgi -- -ra + + py38-test-instrumentation-grpc-0: + name: instrumentation-grpc-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-grpc-0 -- -ra + + py38-test-instrumentation-grpc-1: + name: instrumentation-grpc-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-grpc-1 -- -ra + + py38-test-instrumentation-sqlalchemy-1: + name: instrumentation-sqlalchemy-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-sqlalchemy-1 -- -ra + + py38-test-instrumentation-sqlalchemy-2: + name: instrumentation-sqlalchemy-2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-sqlalchemy-2 -- -ra + + py38-test-instrumentation-redis: + name: instrumentation-redis + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-redis -- -ra + + py38-test-instrumentation-remoulade: + name: instrumentation-remoulade + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-remoulade -- -ra + + py38-test-instrumentation-celery: + name: instrumentation-celery + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-celery -- -ra + + py38-test-instrumentation-system-metrics: + name: instrumentation-system-metrics + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-system-metrics -- -ra + + py38-test-instrumentation-threading: + name: instrumentation-threading + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-threading -- -ra + + py38-test-instrumentation-tornado: + name: instrumentation-tornado + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-tornado -- -ra + + py38-test-instrumentation-tortoiseorm: + name: instrumentation-tortoiseorm + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-tortoiseorm -- -ra + + py38-test-instrumentation-httpx-0: + name: instrumentation-httpx-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-httpx-0 -- -ra + + py38-test-instrumentation-httpx-1: + name: instrumentation-httpx-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-httpx-1 -- -ra + + py38-test-util-http: + name: util-http + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-util-http -- -ra + + py38-test-propagator-aws-xray-0: + name: propagator-aws-xray-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-propagator-aws-xray-0 -- -ra + + py38-test-propagator-aws-xray-1: + name: propagator-aws-xray-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-propagator-aws-xray-1 -- -ra + + py38-test-propagator-ot-trace: + name: propagator-ot-trace + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-propagator-ot-trace -- -ra + + py38-test-instrumentation-sio-pika-0: + name: instrumentation-sio-pika-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-sio-pika-0 -- -ra + + py38-test-instrumentation-sio-pika-1: + name: instrumentation-sio-pika-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-sio-pika-1 -- -ra + + py38-test-instrumentation-aio-pika-0: + name: instrumentation-aio-pika-0 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aio-pika-0 -- -ra + + py38-test-instrumentation-aio-pika-1: + name: instrumentation-aio-pika-1 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aio-pika-1 -- -ra + + py38-test-instrumentation-aio-pika-2: + name: instrumentation-aio-pika-2 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aio-pika-2 -- -ra + + py38-test-instrumentation-aio-pika-3: + name: instrumentation-aio-pika-3 + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aio-pika-3 -- -ra + + py38-test-instrumentation-aiokafka: + name: instrumentation-aiokafka + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aiokafka -- -ra + + py38-test-instrumentation-kafka-python: + name: instrumentation-kafka-python + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-kafka-python -- -ra + + py38-test-instrumentation-kafka-pythonng: + name: instrumentation-kafka-pythonng + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-kafka-pythonng -- -ra + + py38-test-instrumentation-confluent-kafka: + name: instrumentation-confluent-kafka + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-confluent-kafka -- -ra + + py38-test-instrumentation-asyncio: + name: instrumentation-asyncio + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-asyncio -- -ra + + py38-test-instrumentation-cassandra: + name: instrumentation-cassandra + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-cassandra -- -ra + + py38-test-processor-baggage: + name: processor-baggage + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-processor-baggage -- -ra diff --git a/.github/workflows/generate_workflows.py b/.github/workflows/generate_workflows.py index bda8eee827..09391a240c 100644 --- a/.github/workflows/generate_workflows.py +++ b/.github/workflows/generate_workflows.py @@ -1,6 +1,7 @@ from pathlib import Path from generate_workflows_lib import ( + generate_contrib_workflow, generate_lint_workflow, generate_misc_workflow, generate_test_workflow, @@ -12,3 +13,4 @@ generate_test_workflow(tox_ini_path, workflows_directory_path, "ubuntu-latest") generate_lint_workflow(tox_ini_path, workflows_directory_path) generate_misc_workflow(tox_ini_path, workflows_directory_path) +generate_contrib_workflow(workflows_directory_path) diff --git a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/__init__.py b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/__init__.py index 0308fbe5f3..e60e8e8f81 100644 --- a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/__init__.py +++ b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/__init__.py @@ -170,14 +170,14 @@ def get_misc_job_datas(tox_envs: list) -> list: def _generate_workflow( - job_datas: list, name: str, workflow_directory_path: Path + job_datas: list, name: str, workflow_directory_path: Path, max_jobs=250 ): # Github seems to limit the amount of jobs in a workflow file, that is why # they are split in groups of 250 per workflow file. for file_number, job_datas in enumerate( [ - job_datas[index : index + 250] - for index in range(0, len(job_datas), 250) + job_datas[index : index + max_jobs] + for index in range(0, len(job_datas), max_jobs) ] ): with open( @@ -219,7 +219,7 @@ def generate_contrib_workflow( get_contrib_job_datas( get_tox_envs(Path(__file__).parent.joinpath("tox.ini")) ), - "contrib", + "core_contrib_test", workflow_directory_path, ) diff --git a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/contrib.yml.j2 b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/core_contrib_test.yml.j2 similarity index 67% rename from .github/workflows/generate_workflows_lib/src/generate_workflows_lib/contrib.yml.j2 rename to .github/workflows/generate_workflows_lib/src/generate_workflows_lib/core_contrib_test.yml.j2 index 2989e55974..5553caf8eb 100644 --- a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/contrib.yml.j2 +++ b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/core_contrib_test.yml.j2 @@ -1,17 +1,20 @@ # Do not edit this file. # This file is generated automatically by executing tox -e generate-workflows -name: Contrib {{ file_number }} +name: Core Contrib Test {{ file_number }} on: - push: - branches-ignore: - - 'release/*' - pull_request: - + workflow_call: + inputs: + CORE_REPO_SHA: + required: true + type: string + CONTRIB_REPO_SHA: + required: true + type: string env: - CORE_REPO_SHA: ${% raw %}{{ github.sha }}{% endraw %} - CONTRIB_REPO_SHA: main + CORE_REPO_SHA: ${% raw %}{{ inputs.CORE_REPO_SHA }}{% endraw %} + CONTRIB_REPO_SHA: ${% raw %}{{ inputs.CONTRIB_REPO_SHA }}{% endraw %} PIP_EXISTS_ACTION: w jobs: @@ -27,12 +30,6 @@ jobs: repository: open-telemetry/opentelemetry-python-contrib ref: ${% raw %}{{ env.CONTRIB_REPO_SHA }}{% endraw %} - - name: Checkout core repo @ SHA - ${% raw %}{{ github.sha }}{% endraw %} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python - path: opentelemetry-python-core - - name: Set up Python 3.8 uses: actions/setup-python@v5 with: diff --git a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 index add97c645a..9972507bb6 100644 --- a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 +++ b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 @@ -51,10 +51,10 @@ jobs: run: git checkout ${% raw %}{{ github.event.pull_request.head.sha }}{% endraw %} {%- endif %} - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox diff --git a/.github/workflows/lint_0.yml b/.github/workflows/lint_0.yml index 1fd3198785..9d77ef5e27 100644 --- a/.github/workflows/lint_0.yml +++ b/.github/workflows/lint_0.yml @@ -286,6 +286,24 @@ jobs: - name: Run tests run: tox -e lint-instrumentation-boto + lint-instrumentation-click: + name: instrumentation-click + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e lint-instrumentation-click + lint-instrumentation-elasticsearch: name: instrumentation-elasticsearch runs-on: ubuntu-latest diff --git a/.github/workflows/misc_0.yml b/.github/workflows/misc_0.yml index ca94a69563..1148f85abd 100644 --- a/.github/workflows/misc_0.yml +++ b/.github/workflows/misc_0.yml @@ -23,10 +23,10 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox @@ -41,10 +41,10 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox @@ -61,10 +61,10 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox @@ -79,10 +79,10 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox @@ -103,10 +103,10 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox @@ -124,10 +124,10 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox @@ -142,10 +142,10 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml index 1b8376fdc2..47c9a19cf3 100644 --- a/.github/workflows/test_0.yml +++ b/.github/workflows/test_0.yml @@ -2032,6 +2032,114 @@ jobs: - name: Run tests run: tox -e py311-test-instrumentation-boto -- -ra + py38-test-instrumentation-click_ubuntu-latest: + name: instrumentation-click 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-click -- -ra + + py39-test-instrumentation-click_ubuntu-latest: + name: instrumentation-click 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py39-test-instrumentation-click -- -ra + + py310-test-instrumentation-click_ubuntu-latest: + name: instrumentation-click 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py310-test-instrumentation-click -- -ra + + py311-test-instrumentation-click_ubuntu-latest: + name: instrumentation-click 3.11 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py311-test-instrumentation-click -- -ra + + py312-test-instrumentation-click_ubuntu-latest: + name: instrumentation-click 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py312-test-instrumentation-click -- -ra + + pypy3-test-instrumentation-click_ubuntu-latest: + name: instrumentation-click pypy-3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.8 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e pypy3-test-instrumentation-click -- -ra + py38-test-instrumentation-elasticsearch-0_ubuntu-latest: name: instrumentation-elasticsearch-0 3.8 Ubuntu runs-on: ubuntu-latest @@ -4407,111 +4515,3 @@ jobs: - name: Run tests run: tox -e py312-test-instrumentation-psycopg2 -- -ra - - py38-test-instrumentation-psycopg_ubuntu-latest: - name: instrumentation-psycopg 3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py38-test-instrumentation-psycopg -- -ra - - py39-test-instrumentation-psycopg_ubuntu-latest: - name: instrumentation-psycopg 3.9 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py39-test-instrumentation-psycopg -- -ra - - py310-test-instrumentation-psycopg_ubuntu-latest: - name: instrumentation-psycopg 3.10 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py310-test-instrumentation-psycopg -- -ra - - py311-test-instrumentation-psycopg_ubuntu-latest: - name: instrumentation-psycopg 3.11 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py311-test-instrumentation-psycopg -- -ra - - py312-test-instrumentation-psycopg_ubuntu-latest: - name: instrumentation-psycopg 3.12 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py312-test-instrumentation-psycopg -- -ra - - pypy3-test-instrumentation-psycopg_ubuntu-latest: - name: instrumentation-psycopg pypy-3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.8 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.8" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e pypy3-test-instrumentation-psycopg -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index 227c891d0b..9c5d48aea3 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -16,6 +16,114 @@ env: jobs: + py38-test-instrumentation-psycopg_ubuntu-latest: + name: instrumentation-psycopg 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-psycopg -- -ra + + py39-test-instrumentation-psycopg_ubuntu-latest: + name: instrumentation-psycopg 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py39-test-instrumentation-psycopg -- -ra + + py310-test-instrumentation-psycopg_ubuntu-latest: + name: instrumentation-psycopg 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py310-test-instrumentation-psycopg -- -ra + + py311-test-instrumentation-psycopg_ubuntu-latest: + name: instrumentation-psycopg 3.11 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py311-test-instrumentation-psycopg -- -ra + + py312-test-instrumentation-psycopg_ubuntu-latest: + name: instrumentation-psycopg 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py312-test-instrumentation-psycopg -- -ra + + pypy3-test-instrumentation-psycopg_ubuntu-latest: + name: instrumentation-psycopg pypy-3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.8 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e pypy3-test-instrumentation-psycopg -- -ra + py38-test-instrumentation-pymemcache-0_ubuntu-latest: name: instrumentation-pymemcache-0 3.8 Ubuntu runs-on: ubuntu-latest @@ -4407,39 +4515,3 @@ jobs: - name: Run tests run: tox -e py311-test-processor-baggage -- -ra - - py312-test-processor-baggage_ubuntu-latest: - name: processor-baggage 3.12 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py312-test-processor-baggage -- -ra - - pypy3-test-processor-baggage_ubuntu-latest: - name: processor-baggage pypy-3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.8 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.8" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e pypy3-test-processor-baggage -- -ra diff --git a/.github/workflows/test_2.yml b/.github/workflows/test_2.yml new file mode 100644 index 0000000000..c23866ffa8 --- /dev/null +++ b/.github/workflows/test_2.yml @@ -0,0 +1,53 @@ +# Do not edit this file. +# This file is generated automatically by executing tox -e generate-workflows + +name: Test 2 + +on: + push: + branches-ignore: + - 'release/*' + pull_request: + +env: + CORE_REPO_SHA: main + CONTRIB_REPO_SHA: main + PIP_EXISTS_ACTION: w + +jobs: + + py312-test-processor-baggage_ubuntu-latest: + name: processor-baggage 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py312-test-processor-baggage -- -ra + + pypy3-test-processor-baggage_ubuntu-latest: + name: processor-baggage pypy-3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.8 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e pypy3-test-processor-baggage -- -ra diff --git a/CHANGELOG.md b/CHANGELOG.md index cc39664729..33f83bb0ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `opentelemetry-instrumentation-starlette` Add type hints to the instrumentation + ([#3045](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3045)) +- `opentelemetry-distro` default to OTLP log exporter. + ([#3042](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3042)) - `opentelemetry-instrumentation-sqlalchemy` Update unit tests to run with SQLALchemy 2 ([#2976](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2976)) - Add `opentelemetry-instrumentation-openai-v2` to `opentelemetry-bootstrap` @@ -27,9 +31,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2941](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2941)) - `opentelemetry-instrumentation-pymysql` Add sqlcommenter support ([#2942](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2942)) +- `opentelemetry-instrumentation-click`: new instrumentation to trace click commands + ([#2994](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2994)) ### Fixed +- `opentelemetry-instrumentation-starlette`: Retrieve `meter_provider` key instead of `_meter_provider` on `_instrument` + ([#3048](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3048)) - `opentelemetry-instrumentation-httpx`: instrument_client is a static method again ([#3003](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3003)) - `opentelemetry-instrumentation-system_metrics`: fix callbacks reading wrong config @@ -40,6 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3037](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3037)) - `opentelemetry-instrumentation-sqlalchemy` Fixes engines from `sqlalchemy.engine_from_config` not being fully instrumented ([#2816](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2816)) +- `opentelemetry-instrumentation-sqlalchemy`: Fix a remaining memory leak in EngineTracer + ([#3053](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3053)) ### Breaking changes diff --git a/docs-requirements.txt b/docs-requirements.txt index 6342594af3..43e2265f7c 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -33,9 +33,11 @@ elasticsearch>=6.0,<9.0 flask~=2.0 falcon~=2.0 grpcio~=1.27 +httpx>=0.18.0 kafka-python>=2.0,<3.0 mysql-connector-python~=8.0 mysqlclient~=2.1.1 +openai >= 1.26.0 psutil>=5 psycopg~=3.1.17 pika>=0.12.0 @@ -47,7 +49,6 @@ remoulade>=0.50 sqlalchemy>=1.0 tornado>=5.1.1 tortoise-orm>=0.17.0 -httpx>=0.18.0 # indirect dependency pins markupsafe==2.0.1 diff --git a/docs/conf.py b/docs/conf.py index 4b2bda04a8..8233fccb15 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -40,6 +40,13 @@ if isdir(join(instr, f)) ] +instr_genai = "../instrumentation-genai" +instr_genai_dirs = [ + os.path.abspath("/".join(["../instrumentation-genai", f, "src"])) + for f in listdir(instr_genai) + if isdir(join(instr_genai, f)) +] + prop = "../propagator" prop_dirs = [ os.path.abspath("/".join([prop, f, "src"])) @@ -60,7 +67,14 @@ for f in listdir(resource) if isdir(join(resource, f)) ] -sys.path[:0] = exp_dirs + instr_dirs + sdk_ext_dirs + prop_dirs + resource_dirs +sys.path[:0] = ( + exp_dirs + + instr_dirs + + instr_genai_dirs + + sdk_ext_dirs + + prop_dirs + + resource_dirs +) # -- Project information ----------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index e2bf32e12e..f9144c5209 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -24,7 +24,7 @@ installed separately via pip: pip install opentelemetry-instrumentation-{instrumentation} pip install opentelemetry-sdk-extension-{sdk-extension} -A complete list of packages can be found at the +A complete list of packages can be found at the `Contrib repo instrumentation `_ and `Contrib repo exporter `_ directories. @@ -50,6 +50,7 @@ install cd opentelemetry-python-contrib pip install -e ./instrumentation/opentelemetry-instrumentation-flask pip install -e ./instrumentation/opentelemetry-instrumentation-botocore + pip install -e ./instrumentation-genai/opentelemetry-instrumentation-openai-v2 pip install -e ./sdk-extension/opentelemetry-sdk-extension-aws pip install -e ./resource/opentelemetry-resource-detector-container @@ -62,6 +63,14 @@ install instrumentation/** +.. toctree:: + :maxdepth: 2 + :caption: OpenTelemetry Generative AI Instrumentations + :name: Generative AI Instrumentations + :glob: + + instrumentation-genai/** + .. toctree:: :maxdepth: 2 :caption: OpenTelemetry Propagators diff --git a/docs/instrumentation-genai/openai.rst b/docs/instrumentation-genai/openai.rst new file mode 100644 index 0000000000..71f464c533 --- /dev/null +++ b/docs/instrumentation-genai/openai.rst @@ -0,0 +1,7 @@ +OpenTelemetry Python - OpenAI Instrumentation +============================================= + +.. automodule:: opentelemetry.instrumentation.openai_v2 + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/instrumentation/aiohttp_server/aiohttp_server.rst b/docs/instrumentation/aiohttp_server/aiohttp_server.rst new file mode 100644 index 0000000000..a4de9c4eaa --- /dev/null +++ b/docs/instrumentation/aiohttp_server/aiohttp_server.rst @@ -0,0 +1,7 @@ +.. include:: ../../../instrumentation/opentelemetry-instrumentation-aiohttp-server/README.rst + :end-before: References + +.. automodule:: opentelemetry.instrumentation.aiohttp_server + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/instrumentation/click/click.rst b/docs/instrumentation/click/click.rst new file mode 100644 index 0000000000..61da603a7c --- /dev/null +++ b/docs/instrumentation/click/click.rst @@ -0,0 +1,7 @@ +.. include:: ../../../instrumentation/opentelemetry-instrumentation-click/README.rst + :end-before: References + +.. automodule:: opentelemetry.instrumentation.click + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/nitpick-exceptions.ini b/docs/nitpick-exceptions.ini index 9dc379cf93..4b1b06f95b 100644 --- a/docs/nitpick-exceptions.ini +++ b/docs/nitpick-exceptions.ini @@ -24,10 +24,12 @@ py-class= httpx.Client httpx.AsyncClient httpx.BaseTransport + openai.BaseTransport httpx.AsyncBaseTransport httpx.SyncByteStream httpx.AsyncByteStream httpx.Response + aiohttp.web_request.Request yarl.URL cimpl.Producer cimpl.Consumer @@ -64,7 +66,7 @@ any= py-obj= opentelemetry.propagators.textmap.CarrierT - + py-func= poll flush diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst index bbd142a97e..d2cb0b5724 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst @@ -19,8 +19,60 @@ package to your requirements. pip install opentelemetry-instrumentation-openai-v2 -If you don't have an OpenAI application, yet, try our `example `_ -which only needs a valid OpenAI API key. +If you don't have an OpenAI application, yet, try our `examples `_ +which only need a valid OpenAI API key. + +Check out `zero-code example `_ for a quick start. + +Usage +----- + +This section describes how to set up OpenAI instrumentation if you're setting OpenTelemetry up manually. +Check out the `manual example `_ for more details. + +Instrumenting all clients +************************* + +When using the instrumentor, all clients will automatically trace OpenAI chat completion operations. +You can also optionally capture prompts and completions as log events. + +Make sure to configure OpenTelemetry tracing, logging, and events to capture all telemetry emitted by the instrumentation. + +.. code-block:: python + + from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor + + OpenAIInstrumentor().instrument() + + client = OpenAI() + response = client.chat.completions.create( + model="gpt-4o-mini", + messages=[ + {"role": "user", "content": "Write a short poem on open telemetry."}, + ], + ) + +Enabling message content +************************* + +Message content such as the contents of the prompt, completion, function arguments and return values +are not captured by default. To capture message content as log events, set the environment variable +`OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` to `true`. + +Uninstrument +************ + +To uninstrument clients, call the uninstrument method: + +.. code-block:: python + + from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor + + OpenAIInstrumentor().instrument() + # ... + + # Uninstrument all clients + OpenAIInstrumentor().uninstrument() References ---------- diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/.env b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/.env new file mode 100644 index 0000000000..1e77ee78c0 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/.env @@ -0,0 +1,16 @@ +# Update this with your real OpenAI API key +OPENAI_API_KEY=sk-YOUR_API_KEY + +# Uncomment to use Ollama instead of OpenAI +# OPENAI_BASE_URL=http://localhost:11434/v1 +# OPENAI_API_KEY=unused +# CHAT_MODEL=qwen2.5:0.5b + +# Uncomment and change to your OTLP endpoint +# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 +# OTEL_EXPORTER_OTLP_PROTOCOL=grpc + +OTEL_SERVICE_NAME=opentelemetry-python-openai + +# Change to 'false' to hide prompt and completion content +OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/README.rst similarity index 67% rename from instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/README.rst rename to instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/README.rst index 019e141c70..73e4d1bb0c 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/README.rst @@ -1,8 +1,7 @@ OpenTelemetry OpenAI Instrumentation Example ============================================ -This is an example of how to instrument OpenAI calls with zero code changes, -using `opentelemetry-instrument`. +This is an example of how to instrument OpenAI calls when configuring OpenTelemetry SDK and Instrumentations manually. When `main.py `_ is run, it exports traces and logs to an OTLP compatible endpoint. Traces include details such as the model used and the @@ -10,12 +9,18 @@ duration of the chat request. Logs capture the chat request and the generated response, providing a comprehensive view of the performance and behavior of your OpenAI requests. +Note: `.env <.env>`_ file configures additional environment variables: + +- `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true` configures +OpenAI instrumentation to capture prompt and completion contents on +events. + Setup ----- Minimally, update the `.env <.env>`_ file with your "OPENAI_API_KEY". An OTLP compatible endpoint should be listening for traces and logs on -http://localhost:4318. If not, update "OTEL_EXPORTER_OTLP_ENDPOINT" as well. +http://localhost:4317. If not, update "OTEL_EXPORTER_OTLP_ENDPOINT" as well. Next, set up a virtual environment like this: @@ -33,7 +38,7 @@ Run the example like this: :: - dotenv run -- opentelemetry-instrument python main.py + dotenv run -- python main.py You should see a poem generated by OpenAI while traces and logs export to your configured observability tool. diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/main.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/main.py new file mode 100644 index 0000000000..4b0c121b7a --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/main.py @@ -0,0 +1,53 @@ +# pylint: skip-file +import os + +from openai import OpenAI + +# NOTE: OpenTelemetry Python Logs and Events APIs are in beta +from opentelemetry import _events, _logs, trace +from opentelemetry.exporter.otlp.proto.grpc._log_exporter import ( + OTLPLogExporter, +) +from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import ( + OTLPSpanExporter, +) +from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor +from opentelemetry.sdk._events import EventLoggerProvider +from opentelemetry.sdk._logs import LoggerProvider +from opentelemetry.sdk._logs.export import BatchLogRecordProcessor +from opentelemetry.sdk.trace import TracerProvider +from opentelemetry.sdk.trace.export import BatchSpanProcessor + +# configure tracing +trace.set_tracer_provider(TracerProvider()) +trace.get_tracer_provider().add_span_processor( + BatchSpanProcessor(OTLPSpanExporter()) +) + +# configure logging and events +_logs.set_logger_provider(LoggerProvider()) +_logs.get_logger_provider().add_log_record_processor( + BatchLogRecordProcessor(OTLPLogExporter()) +) +_events.set_event_logger_provider(EventLoggerProvider()) + +# instrument OpenAI +OpenAIInstrumentor().instrument() + + +def main(): + client = OpenAI() + chat_completion = client.chat.completions.create( + model=os.getenv("CHAT_MODEL", "gpt-4o-mini"), + messages=[ + { + "role": "user", + "content": "Write a short poem on OpenTelemetry.", + }, + ], + ) + print(chat_completion.choices[0].message.content) + + +if __name__ == "__main__": + main() diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/requirements.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/requirements.txt new file mode 100644 index 0000000000..436f63e1d5 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/manual/requirements.txt @@ -0,0 +1,5 @@ +openai~=1.54.4 + +opentelemetry-sdk~=1.28.2 +opentelemetry-exporter-otlp-proto-grpc~=1.28.2 +opentelemetry-instrumentation-openai-v2~=2.0b0 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/.env b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env similarity index 65% rename from instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/.env rename to instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env index d6afa66723..7dfa745e3b 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/.env +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env @@ -6,13 +6,16 @@ OPENAI_API_KEY=sk-YOUR_API_KEY # OPENAI_API_KEY=unused # CHAT_MODEL=qwen2.5:0.5b -OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 -OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf +# Uncomment and change to your OTLP endpoint +# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 +# OTEL_EXPORTER_OTLP_PROTOCOL=grpc + OTEL_SERVICE_NAME=opentelemetry-python-openai # Change to 'false' to disable logging OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true # Change to 'console' if your OTLP endpoint doesn't support logs -OTEL_LOGS_EXPORTER=otlp_proto_http +# TODO: this should not be necessary once https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3042 is released +OTEL_LOGS_EXPORTER=otlp # Change to 'false' to hide prompt and completion content OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst new file mode 100644 index 0000000000..441c6a612e --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst @@ -0,0 +1,48 @@ +OpenTelemetry OpenAI Zero-Code Instrumentation Example +====================================================== + +This is an example of how to instrument OpenAI calls with zero code changes, +using `opentelemetry-instrument`. + +When `main.py `_ is run, it exports traces and logs to an OTLP +compatible endpoint. Traces include details such as the model used and the +duration of the chat request. Logs capture the chat request and the generated +response, providing a comprehensive view of the performance and behavior of +your OpenAI requests. + +Note: `.env <.env>`_ file configures additional environment variables: + +- `OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true` configures +OpenTelemetry SDK to export logs and events. +- `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true` configures +OpenAI instrumentation to capture prompt and completion contents on +events. +- `OTEL_LOGS_EXPORTER=otlp` to specify exporter type. + +Setup +----- + +Minimally, update the `.env <.env>`_ file with your "OPENAI_API_KEY". An +OTLP compatible endpoint should be listening for traces and logs on +http://localhost:4317. If not, update "OTEL_EXPORTER_OTLP_ENDPOINT" as well. + +Next, set up a virtual environment like this: + +:: + + python3 -m venv .venv + source .venv/bin/activate + pip install "python-dotenv[cli]" + pip install -r requirements.txt + +Run +--- + +Run the example like this: + +:: + + dotenv run -- opentelemetry-instrument python main.py + +You should see a poem generated by OpenAI while traces and logs export to your +configured observability tool. diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/main.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/main.py similarity index 100% rename from instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/main.py rename to instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/main.py diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/requirements.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/requirements.txt similarity index 71% rename from instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/requirements.txt rename to instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/requirements.txt index 9ec9bff320..77ed112ebb 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/example/requirements.txt +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/requirements.txt @@ -1,6 +1,6 @@ openai~=1.54.4 opentelemetry-sdk~=1.28.2 -opentelemetry-exporter-otlp-proto-http~=1.28.2 +opentelemetry-exporter-otlp-proto-grpc~=1.28.2 opentelemetry-distro~=0.49b2 opentelemetry-instrumentation-openai-v2~=2.0b0 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml index e28611d0c5..f37b6915e3 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml @@ -39,7 +39,7 @@ instruments = [ openai = "opentelemetry.instrumentation.openai_v2:OpenAIInstrumentor" [project.urls] -Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-openai-v2" +Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-openai-v2" [tool.hatch.version] path = "src/opentelemetry/instrumentation/openai_v2/version.py" diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-0.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-0.txt index 5e1693b69a..bd22b7a870 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-0.txt +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-0.txt @@ -1,5 +1,6 @@ openai==1.26.0 pydantic==2.8.2 +httpx==0.27.2 Deprecated==1.2.14 importlib-metadata==6.11.0 packaging==24.0 @@ -7,6 +8,7 @@ pytest==7.4.4 pytest-vcr==1.0.2 pytest-asyncio==0.21.0 wrapt==1.16.0 +opentelemetry-exporter-otlp-proto-http~=1.28 opentelemetry-api==1.28 # when updating, also update in pyproject.toml opentelemetry-sdk==1.28 # when updating, also update in pyproject.toml opentelemetry-semantic-conventions==0.49b0 # when updating, also update in pyproject.toml diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-1.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-1.txt index 618410edd3..6725ed7b66 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-1.txt +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/test-requirements-1.txt @@ -1,5 +1,6 @@ openai==1.26.0 pydantic==2.8.2 +httpx==0.27.2 Deprecated==1.2.14 importlib-metadata==6.11.0 packaging==24.0 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_async_chat_completion_no_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_async_chat_completion_no_content.yaml new file mode 100644 index 0000000000..61ec4a646e --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_async_chat_completion_no_content.yaml @@ -0,0 +1,132 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Say this is a test" + } + ], + "model": "gpt-4o-mini", + "stream": false + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '106' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.26.0 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.26.0 + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.5 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASv9R2E7Yhb2e7bj4Xl0qm9s3J42Y", + "object": "chat.completion", + "created": 1731456237, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "This is a test. How can I assist you further?", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 12, + "completion_tokens": 12, + "total_tokens": 24, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e1a80679a8311a6-MRS + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 13 Nov 2024 00:03:58 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '796' + openai-organization: test_openai_org_id + openai-processing-ms: + - '359' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999978' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_41ea134c1fc450d4ca4cf8d0c6a7c53a + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_chat_completion_no_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_chat_completion_no_content.yaml new file mode 100644 index 0000000000..2abb443fe3 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_chat_completion_no_content.yaml @@ -0,0 +1,134 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Say this is a test" + } + ], + "model": "gpt-4o-mini", + "stream": false + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '106' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASYMQRl3A3DXL9FWCK9tnGRcKIO7q", + "object": "chat.completion", + "created": 1731368630, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "This is a test.", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 12, + "completion_tokens": 5, + "total_tokens": 17, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e122593ff368bc8-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 11 Nov 2024 23:43:50 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '765' + openai-organization: test_openai_org_id + openai-processing-ms: + - '287' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199977' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 6ms + x-request-id: + - req_58cff97afd0e7c0bba910ccf0b044a6f + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py index 7ff7e46777..18e6582dff 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py @@ -84,6 +84,10 @@ def vcr_config(): @pytest.fixture(scope="function") def instrument_no_content(tracer_provider, event_logger_provider): + os.environ.update( + {OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT: "False"} + ) + instrumentor = OpenAIInstrumentor() instrumentor.instrument( tracer_provider=tracer_provider, @@ -91,6 +95,7 @@ def instrument_no_content(tracer_provider, event_logger_provider): ) yield instrumentor + os.environ.pop(OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, None) instrumentor.uninstrument() diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_async_chat_completions.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_async_chat_completions.py index 1c4b3cb7dd..e19bc7c311 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_async_chat_completions.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_async_chat_completions.py @@ -68,6 +68,34 @@ async def test_async_chat_completion_with_content( assert_message_in_logs(logs[1], "gen_ai.choice", choice_event, spans[0]) +@pytest.mark.vcr() +@pytest.mark.asyncio() +async def test_async_chat_completion_no_content( + span_exporter, log_exporter, async_openai_client, instrument_no_content +): + llm_model_value = "gpt-4o-mini" + messages_value = [{"role": "user", "content": "Say this is a test"}] + + response = await async_openai_client.chat.completions.create( + messages=messages_value, model=llm_model_value, stream=False + ) + + spans = span_exporter.get_finished_spans() + assert_completion_attributes(spans[0], llm_model_value, response) + + logs = log_exporter.get_finished_logs() + assert len(logs) == 2 + + assert_message_in_logs(logs[0], "gen_ai.user.message", None, spans[0]) + + choice_event = { + "index": 0, + "finish_reason": "stop", + "message": {"role": "assistant"}, + } + assert_message_in_logs(logs[1], "gen_ai.choice", choice_event, spans[0]) + + @pytest.mark.asyncio() async def test_async_chat_completion_bad_endpoint( span_exporter, instrument_no_content diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_chat_completions.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_chat_completions.py index c6cb19aa8d..4f732290c0 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_chat_completions.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_chat_completions.py @@ -67,6 +67,33 @@ def test_chat_completion_with_content( assert_message_in_logs(logs[1], "gen_ai.choice", choice_event, spans[0]) +@pytest.mark.vcr() +def test_chat_completion_no_content( + span_exporter, log_exporter, openai_client, instrument_no_content +): + llm_model_value = "gpt-4o-mini" + messages_value = [{"role": "user", "content": "Say this is a test"}] + + response = openai_client.chat.completions.create( + messages=messages_value, model=llm_model_value, stream=False + ) + + spans = span_exporter.get_finished_spans() + assert_completion_attributes(spans[0], llm_model_value, response) + + logs = log_exporter.get_finished_logs() + assert len(logs) == 2 + + assert_message_in_logs(logs[0], "gen_ai.user.message", None, spans[0]) + + choice_event = { + "index": 0, + "finish_reason": "stop", + "message": {"role": "assistant"}, + } + assert_message_in_logs(logs[1], "gen_ai.choice", choice_event, spans[0]) + + def test_chat_completion_bad_endpoint(span_exporter, instrument_no_content): llm_model_value = "gpt-4o-mini" messages_value = [{"role": "user", "content": "Say this is a test"}] diff --git a/instrumentation/README.md b/instrumentation/README.md index fb601266ea..bff37fde6c 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -15,6 +15,7 @@ | [opentelemetry-instrumentation-botocore](./opentelemetry-instrumentation-botocore) | botocore ~= 1.0 | No | experimental | [opentelemetry-instrumentation-cassandra](./opentelemetry-instrumentation-cassandra) | cassandra-driver ~= 3.25,scylla-driver ~= 3.25 | No | experimental | [opentelemetry-instrumentation-celery](./opentelemetry-instrumentation-celery) | celery >= 4.0, < 6.0 | No | experimental +| [opentelemetry-instrumentation-click](./opentelemetry-instrumentation-click) | click >= 8.1.3, < 9.0.0 | No | experimental | [opentelemetry-instrumentation-confluent-kafka](./opentelemetry-instrumentation-confluent-kafka) | confluent-kafka >= 1.8.2, <= 2.4.0 | No | experimental | [opentelemetry-instrumentation-dbapi](./opentelemetry-instrumentation-dbapi) | dbapi | No | experimental | [opentelemetry-instrumentation-django](./opentelemetry-instrumentation-django) | django >= 1.10 | Yes | experimental diff --git a/instrumentation/opentelemetry-instrumentation-click/README.rst b/instrumentation/opentelemetry-instrumentation-click/README.rst new file mode 100644 index 0000000000..4dde08a99a --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-click/README.rst @@ -0,0 +1,24 @@ +OpenTelemetry click Instrumentation +==================================== + +|pypi| + +.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-click.svg + :target: https://pypi.org/project/opentelemetry-instrumentation-click/ + +This library allows tracing requests made by the click library. + +Installation +------------ + + +:: + + pip install opentelemetry-instrumentation-click + + +References +---------- + +* `OpenTelemetry click/ Tracing `_ +* `OpenTelemetry Project `_ diff --git a/instrumentation/opentelemetry-instrumentation-click/pyproject.toml b/instrumentation/opentelemetry-instrumentation-click/pyproject.toml new file mode 100644 index 0000000000..d5b8e71830 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-click/pyproject.toml @@ -0,0 +1,54 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "opentelemetry-instrumentation-click" +dynamic = ["version"] +description = "Click instrumentation for OpenTelemetry" +readme = "README.rst" +license = "Apache-2.0" +requires-python = ">=3.8" +authors = [ + { name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +dependencies = [ + "opentelemetry-api ~= 1.12", + "opentelemetry-semantic-conventions == 0.50b0.dev", + "wrapt >= 1.0.0, < 2.0.0", +] + +[project.optional-dependencies] +instruments = [ + "click >= 8.1.3, < 9.0.0", +] + +[project.entry-points.opentelemetry_instrumentor] +click = "opentelemetry.instrumentation.click:ClickInstrumentor" + +[project.urls] +Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-click" + +[tool.hatch.version] +path = "src/opentelemetry/instrumentation/click/version.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/src", + "/tests", +] + +[tool.hatch.build.targets.wheel] +packages = ["src/opentelemetry"] diff --git a/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/__init__.py b/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/__init__.py new file mode 100644 index 0000000000..8222bfdf5a --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/__init__.py @@ -0,0 +1,122 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Instrument `click`_ CLI applications. + +.. _click: https://pypi.org/project/click/ + +Usage +----- + +.. code-block:: python + + import click + from opentelemetry.instrumentation.click import ClickInstrumentor + + ClickInstrumentor().instrument() + + @click.command() + def hello(): + click.echo(f'Hello world!') + + if __name__ == "__main__": + hello() + +API +--- +""" + +import os +import sys +from functools import partial +from logging import getLogger +from typing import Collection + +import click +from wrapt import wrap_function_wrapper + +from opentelemetry import trace +from opentelemetry.instrumentation.click.package import _instruments +from opentelemetry.instrumentation.click.version import __version__ +from opentelemetry.instrumentation.instrumentor import BaseInstrumentor +from opentelemetry.instrumentation.utils import ( + unwrap, +) +from opentelemetry.semconv._incubating.attributes.process_attributes import ( + PROCESS_COMMAND_ARGS, + PROCESS_EXECUTABLE_NAME, + PROCESS_EXIT_CODE, + PROCESS_PID, +) +from opentelemetry.semconv.attributes.error_attributes import ERROR_TYPE +from opentelemetry.trace.status import StatusCode + +_logger = getLogger(__name__) + + +def _command_invoke_wrapper(wrapped, instance, args, kwargs, tracer): + # Subclasses of Command include groups and CLI runners, but + # we only want to instrument the actual commands which are + # instances of Command itself. + if instance.__class__ != click.Command: + return wrapped(*args, **kwargs) + + ctx = args[0] + span_name = ctx.info_name + span_attributes = { + PROCESS_COMMAND_ARGS: sys.argv, + PROCESS_EXECUTABLE_NAME: sys.argv[0], + PROCESS_EXIT_CODE: 0, + PROCESS_PID: os.getpid(), + } + + with tracer.start_as_current_span( + name=span_name, + kind=trace.SpanKind.INTERNAL, + attributes=span_attributes, + ) as span: + try: + return wrapped(*args, **kwargs) + except Exception as exc: + span.set_status(StatusCode.ERROR, str(exc)) + if span.is_recording(): + span.set_attribute(ERROR_TYPE, exc.__class__.__qualname__) + span.set_attribute( + PROCESS_EXIT_CODE, getattr(exc, "exit_code", 1) + ) + raise + + +class ClickInstrumentor(BaseInstrumentor): + """An instrumentor for click""" + + def instrumentation_dependencies(self) -> Collection[str]: + return _instruments + + def _instrument(self, **kwargs): + tracer = trace.get_tracer( + __name__, + __version__, + kwargs.get("tracer_provider"), + ) + + wrap_function_wrapper( + click.core.Command, + "invoke", + partial(_command_invoke_wrapper, tracer=tracer), + ) + + def _uninstrument(self, **kwargs): + unwrap(click.core.Command, "invoke") diff --git a/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/package.py b/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/package.py new file mode 100644 index 0000000000..6e0a1db2b5 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/package.py @@ -0,0 +1,16 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +_instruments = ("click >= 8.1.3, < 9.0.0",) diff --git a/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/version.py b/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/version.py new file mode 100644 index 0000000000..0559ba6227 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-click/src/opentelemetry/instrumentation/click/version.py @@ -0,0 +1,15 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__version__ = "0.50b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-click/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-click/test-requirements.txt new file mode 100644 index 0000000000..6e9162ccde --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-click/test-requirements.txt @@ -0,0 +1,15 @@ +asgiref==3.8.1 +click==8.1.7 +Deprecated==1.2.14 +iniconfig==2.0.0 +packaging==24.0 +pluggy==1.5.0 +py-cpuinfo==9.0.0 +pytest==7.4.4 +pytest-asyncio==0.23.5 +tomli==2.0.1 +typing_extensions==4.12.2 +wrapt==1.16.0 +zipp==3.19.2 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-click diff --git a/instrumentation/opentelemetry-instrumentation-click/tests/test_click.py b/instrumentation/opentelemetry-instrumentation-click/tests/test_click.py new file mode 100644 index 0000000000..41d01a5bb4 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-click/tests/test_click.py @@ -0,0 +1,176 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from unittest import mock + +import click +from click.testing import CliRunner + +from opentelemetry.instrumentation.click import ClickInstrumentor +from opentelemetry.test.test_base import TestBase +from opentelemetry.trace import SpanKind +from opentelemetry.trace.status import StatusCode + + +class ClickTestCase(TestBase): + # pylint: disable=unbalanced-tuple-unpacking + def setUp(self): + super().setUp() + + ClickInstrumentor().instrument() + + def tearDown(self): + super().tearDown() + ClickInstrumentor().uninstrument() + + @mock.patch("sys.argv", ["command.py"]) + def test_cli_command_wrapping(self): + @click.command() + def command(): + pass + + runner = CliRunner() + result = runner.invoke(command) + self.assertEqual(result.exit_code, 0) + + (span,) = self.memory_exporter.get_finished_spans() + self.assertEqual(span.status.status_code, StatusCode.UNSET) + self.assertEqual(span.kind, SpanKind.INTERNAL) + self.assertEqual(span.name, "command") + self.assertEqual( + dict(span.attributes), + { + "process.executable.name": "command.py", + "process.command_args": ("command.py",), + "process.exit.code": 0, + "process.pid": os.getpid(), + }, + ) + + @mock.patch("sys.argv", ["flask", "command"]) + def test_flask_run_command_wrapping(self): + @click.command() + def command(): + pass + + runner = CliRunner() + result = runner.invoke(command) + self.assertEqual(result.exit_code, 0) + + (span,) = self.memory_exporter.get_finished_spans() + self.assertEqual(span.status.status_code, StatusCode.UNSET) + self.assertEqual(span.kind, SpanKind.INTERNAL) + self.assertEqual(span.name, "command") + self.assertEqual( + dict(span.attributes), + { + "process.executable.name": "flask", + "process.command_args": ( + "flask", + "command", + ), + "process.exit.code": 0, + "process.pid": os.getpid(), + }, + ) + + @mock.patch("sys.argv", ["command.py"]) + def test_cli_command_wrapping_with_name(self): + @click.command("mycommand") + def renamedcommand(): + pass + + runner = CliRunner() + result = runner.invoke(renamedcommand) + self.assertEqual(result.exit_code, 0) + + (span,) = self.memory_exporter.get_finished_spans() + self.assertEqual(span.status.status_code, StatusCode.UNSET) + self.assertEqual(span.kind, SpanKind.INTERNAL) + self.assertEqual(span.name, "mycommand") + self.assertEqual( + dict(span.attributes), + { + "process.executable.name": "command.py", + "process.command_args": ("command.py",), + "process.exit.code": 0, + "process.pid": os.getpid(), + }, + ) + + @mock.patch("sys.argv", ["command.py", "--opt", "argument"]) + def test_cli_command_wrapping_with_options(self): + @click.command() + @click.argument("argument") + @click.option("--opt/--no-opt", default=False) + def command(argument, opt): + pass + + argv = ["command.py", "--opt", "argument"] + runner = CliRunner() + result = runner.invoke(command, argv[1:]) + self.assertEqual(result.exit_code, 0) + + (span,) = self.memory_exporter.get_finished_spans() + self.assertEqual(span.status.status_code, StatusCode.UNSET) + self.assertEqual(span.kind, SpanKind.INTERNAL) + self.assertEqual(span.name, "command") + self.assertEqual( + dict(span.attributes), + { + "process.executable.name": "command.py", + "process.command_args": tuple(argv), + "process.exit.code": 0, + "process.pid": os.getpid(), + }, + ) + + @mock.patch("sys.argv", ["command-raises.py"]) + def test_cli_command_raises_error(self): + @click.command() + def command_raises(): + raise ValueError() + + runner = CliRunner() + result = runner.invoke(command_raises) + self.assertEqual(result.exit_code, 1) + + (span,) = self.memory_exporter.get_finished_spans() + self.assertEqual(span.status.status_code, StatusCode.ERROR) + self.assertEqual(span.kind, SpanKind.INTERNAL) + self.assertEqual(span.name, "command-raises") + self.assertEqual( + dict(span.attributes), + { + "process.executable.name": "command-raises.py", + "process.command_args": ("command-raises.py",), + "process.exit.code": 1, + "process.pid": os.getpid(), + "error.type": "ValueError", + }, + ) + + def test_uninstrument(self): + ClickInstrumentor().uninstrument() + + @click.command() + def notracecommand(): + pass + + runner = CliRunner() + result = runner.invoke(notracecommand) + self.assertEqual(result.exit_code, 0) + + self.assertFalse(self.memory_exporter.get_finished_spans()) diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py index b64af796d1..a20e481819 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py @@ -167,6 +167,13 @@ def _pool_checkout( self._add_idle_to_connection_usage(-1) self._add_used_to_connection_usage(1) + @classmethod + def _dispose_of_event_listener(cls, obj): + try: + cls._remove_event_listener_params.remove(obj) + except ValueError: + pass + @classmethod def _register_event_listener(cls, target, identifier, func, *args, **kw): listen(target, identifier, func, *args, **kw) @@ -174,6 +181,12 @@ def _register_event_listener(cls, target, identifier, func, *args, **kw): (weakref.ref(target), identifier, func) ) + weakref.finalize( + target, + cls._dispose_of_event_listener, + (weakref.ref(target), identifier, func), + ) + @classmethod def remove_all_event_listeners(cls): for ( diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py index 458ab8a623..27a253decb 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py @@ -428,6 +428,10 @@ def test_no_memory_leakage_if_engine_diposed(self): from sqlalchemy import create_engine + from opentelemetry.instrumentation.sqlalchemy.engine import ( + EngineTracer, + ) + callback = mock.Mock() def make_shortlived_engine(): @@ -443,3 +447,4 @@ def make_shortlived_engine(): gc.collect() assert callback.call_count == 5 + assert len(EngineTracer._remove_event_listener_params) == 0 diff --git a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/py.typed b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py index 50d2fb03d8..5007bda50a 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py @@ -170,7 +170,9 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A --- """ -from typing import Collection +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Collection, cast from starlette import applications from starlette.routing import Match @@ -184,18 +186,29 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.starlette.package import _instruments from opentelemetry.instrumentation.starlette.version import __version__ -from opentelemetry.metrics import get_meter +from opentelemetry.metrics import MeterProvider, get_meter from opentelemetry.semconv.trace import SpanAttributes -from opentelemetry.trace import get_tracer +from opentelemetry.trace import TracerProvider, get_tracer from opentelemetry.util.http import get_excluded_urls +if TYPE_CHECKING: + from typing import TypedDict, Unpack + + class InstrumentKwargs(TypedDict, total=False): + tracer_provider: TracerProvider + meter_provider: MeterProvider + server_request_hook: ServerRequestHook + client_request_hook: ClientRequestHook + client_response_hook: ClientResponseHook + + _excluded_urls = get_excluded_urls("STARLETTE") class StarletteInstrumentor(BaseInstrumentor): - """An instrumentor for starlette + """An instrumentor for Starlette. - See `BaseInstrumentor` + See `BaseInstrumentor`. """ _original_starlette = None @@ -206,8 +219,8 @@ def instrument_app( server_request_hook: ServerRequestHook = None, client_request_hook: ClientRequestHook = None, client_response_hook: ClientResponseHook = None, - meter_provider=None, - tracer_provider=None, + meter_provider: MeterProvider | None = None, + tracer_provider: TracerProvider | None = None, ): """Instrument an uninstrumented Starlette application.""" tracer = get_tracer( @@ -253,7 +266,7 @@ def uninstrument_app(app: applications.Starlette): def instrumentation_dependencies(self) -> Collection[str]: return _instruments - def _instrument(self, **kwargs): + def _instrument(self, **kwargs: Unpack[InstrumentKwargs]): self._original_starlette = applications.Starlette _InstrumentedStarlette._tracer_provider = kwargs.get("tracer_provider") _InstrumentedStarlette._server_request_hook = kwargs.get( @@ -265,11 +278,11 @@ def _instrument(self, **kwargs): _InstrumentedStarlette._client_response_hook = kwargs.get( "client_response_hook" ) - _InstrumentedStarlette._meter_provider = kwargs.get("_meter_provider") + _InstrumentedStarlette._meter_provider = kwargs.get("meter_provider") applications.Starlette = _InstrumentedStarlette - def _uninstrument(self, **kwargs): + def _uninstrument(self, **kwargs: Any): """uninstrumenting all created apps by user""" for instance in _InstrumentedStarlette._instrumented_starlette_apps: self.uninstrument_app(instance) @@ -278,14 +291,14 @@ def _uninstrument(self, **kwargs): class _InstrumentedStarlette(applications.Starlette): - _tracer_provider = None - _meter_provider = None + _tracer_provider: TracerProvider | None = None + _meter_provider: MeterProvider | None = None _server_request_hook: ServerRequestHook = None _client_request_hook: ClientRequestHook = None _client_response_hook: ClientResponseHook = None - _instrumented_starlette_apps = set() + _instrumented_starlette_apps: set[applications.Starlette] = set() - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any): super().__init__(*args, **kwargs) tracer = get_tracer( __name__, @@ -318,21 +331,22 @@ def __del__(self): _InstrumentedStarlette._instrumented_starlette_apps.remove(self) -def _get_route_details(scope): +def _get_route_details(scope: dict[str, Any]) -> str | None: """ - Function to retrieve Starlette route from scope. + Function to retrieve Starlette route from ASGI scope. TODO: there is currently no way to retrieve http.route from a starlette application from scope. See: https://github.com/encode/starlette/pull/804 Args: - scope: A Starlette scope + scope: The ASGI scope that contains the Starlette application in the "app" key. + Returns: - A string containing the route or None + The path to the route if found, otherwise None. """ - app = scope["app"] - route = None + app = cast(applications.Starlette, scope["app"]) + route: str | None = None for starlette_route in app.routes: match, _ = starlette_route.matches(scope) @@ -344,18 +358,20 @@ def _get_route_details(scope): return route -def _get_default_span_details(scope): - """ - Callback to retrieve span name and attributes from scope. +def _get_default_span_details( + scope: dict[str, Any], +) -> tuple[str, dict[str, Any]]: + """Callback to retrieve span name and attributes from ASGI scope. Args: - scope: A Starlette scope + scope: The ASGI scope that contains the Starlette application in the "app" key. + Returns: - A tuple of span name and attributes + A tuple of span name and attributes. """ route = _get_route_details(scope) - method = scope.get("method", "") - attributes = {} + method: str = scope.get("method", "") + attributes: dict[str, Any] = {} if route: attributes[SpanAttributes.HTTP_ROUTE] = route if method and route: # http diff --git a/opentelemetry-contrib-instrumentations/pyproject.toml b/opentelemetry-contrib-instrumentations/pyproject.toml index 11eae92ba6..a0edde1390 100644 --- a/opentelemetry-contrib-instrumentations/pyproject.toml +++ b/opentelemetry-contrib-instrumentations/pyproject.toml @@ -43,6 +43,7 @@ dependencies = [ "opentelemetry-instrumentation-botocore==0.50b0.dev", "opentelemetry-instrumentation-cassandra==0.50b0.dev", "opentelemetry-instrumentation-celery==0.50b0.dev", + "opentelemetry-instrumentation-click==0.50b0.dev", "opentelemetry-instrumentation-confluent-kafka==0.50b0.dev", "opentelemetry-instrumentation-dbapi==0.50b0.dev", "opentelemetry-instrumentation-django==0.50b0.dev", diff --git a/opentelemetry-distro/src/opentelemetry/distro/__init__.py b/opentelemetry-distro/src/opentelemetry/distro/__init__.py index ad61f01ca7..474c2db239 100644 --- a/opentelemetry-distro/src/opentelemetry/distro/__init__.py +++ b/opentelemetry-distro/src/opentelemetry/distro/__init__.py @@ -15,6 +15,7 @@ import os from opentelemetry.environment_variables import ( + OTEL_LOGS_EXPORTER, OTEL_METRICS_EXPORTER, OTEL_TRACES_EXPORTER, ) @@ -37,4 +38,5 @@ class OpenTelemetryDistro(BaseDistro): def _configure(self, **kwargs): os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp") os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp") + os.environ.setdefault(OTEL_LOGS_EXPORTER, "otlp") os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc") diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index 6b7eae6b00..a292299d70 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -72,6 +72,10 @@ "library": "celery >= 4.0, < 6.0", "instrumentation": "opentelemetry-instrumentation-celery==0.50b0.dev", }, + { + "library": "click >= 8.1.3, < 9.0.0", + "instrumentation": "opentelemetry-instrumentation-click==0.50b0.dev", + }, { "library": "confluent-kafka >= 1.8.2, <= 2.4.0", "instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.50b0.dev", diff --git a/tox.ini b/tox.ini index cc5e509abc..5fa58e5139 100644 --- a/tox.ini +++ b/tox.ini @@ -94,6 +94,11 @@ envlist = ; pypy3-test-instrumentation-boto lint-instrumentation-boto + ; opentelemetry-instrumentation-click + py3{8,9,10,11,12}-test-instrumentation-click + pypy3-test-instrumentation-click + lint-instrumentation-click + ; opentelemetry-instrumentation-elasticsearch ; The numbers at the end of the environment names ; below mean these dependencies are being used: @@ -443,6 +448,12 @@ commands_pre = pypy3-test-instrumentation-celery: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-celery/test-requirements-1.txt lint-instrumentation-celery: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-celery/test-requirements-1.txt + click: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api + click: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions + click: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk + click: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils + click: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-click/test-requirements.txt + sio-pika: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api sio-pika: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions sio-pika: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk @@ -876,6 +887,9 @@ commands = test-instrumentation-celery: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-celery/tests {posargs} lint-instrumentation-celery: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-celery" + test-instrumentation-click: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-click/tests {posargs} + lint-instrumentation-click: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-click" + test-instrumentation-dbapi: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi/tests {posargs} lint-instrumentation-dbapi: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-dbapi"