Skip to content

Commit

Permalink
Add click instrumentation (#2994)
Browse files Browse the repository at this point in the history
* Add instrumentation for click based CLI apps

Co-authored-by: Anuraag (Rag) Agrawal <[email protected]>

* Add tox

* Add Changelog

* Silence pylint

* Update tox.ini

Co-authored-by: Emídio Neto <[email protected]>

* Update instrumentation/opentelemetry-instrumentation-click/pyproject.toml

* Add baseline version

* Adhere to new cli span semconv

* Update workflows

---------

Co-authored-by: Anuraag (Rag) Agrawal <[email protected]>
Co-authored-by: Emídio Neto <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2024
1 parent 16ebf25 commit d330ab3
Show file tree
Hide file tree
Showing 17 changed files with 753 additions and 144 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/core_contrib_test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,28 @@ jobs:
- 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
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/lint_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
216 changes: 108 additions & 108 deletions .github/workflows/test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading

0 comments on commit d330ab3

Please sign in to comment.