Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Jun 11, 2024
1 parent da78275 commit d2c7234
Show file tree
Hide file tree
Showing 19 changed files with 265 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[codespell]
# skipping auto generated folders
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,*-requirements*.txt
ignore-words-list = ot
2 changes: 1 addition & 1 deletion .github/workflows/instrumentations_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ jobs:
~/.cache/pip
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra
4 changes: 1 addition & 3 deletions .github/workflows/instrumentations_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ jobs:
- "richconsole"
- "psycopg"
- "prometheus-remote-write"
- "sdk-extension-aws"
- "propagator-aws-xray"
- "propagator-ot-trace"
- "resource-detector-container"
os: [ubuntu-20.04]
exclude:
- python-version: pypy3
Expand All @@ -58,4 +56,4 @@ jobs:
~/.cache/pip
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra
2 changes: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ jobs:
- "processor-baggage"
- "propagator-aws-xray"
- "propagator-ot-trace"
- "resource-detector-container"
- "sdk-extension-aws"
os: [ubuntu-20.04]
runs-on: ubuntu-20.04
steps:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/lint_1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: lint 1

on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2

jobs:
test-1:
env:
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
package:
- "resource/opentelemetry-resource-detector-container"
- "sdk-extension/opentelemetry-sdk-extension-aws"
os: [ubuntu-20.04]
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v4
with:
path: |
.tox
~/.cache/pip
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -c ${{ matrix.package }}/tox.ini -e lint
41 changes: 41 additions & 0 deletions .github/workflows/spellcheck_1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: spellcheck 1

on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2

jobs:
test-1:
env:
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
package:
- "resource/opentelemetry-resource-detector-container"
- "sdk-extension/opentelemetry-sdk-extension-aws"
os: [ubuntu-20.04]
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v4
with:
path: |
.tox
~/.cache/pip
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -c ${{ matrix.package }}/tox.ini -e spellcheck
52 changes: 52 additions & 0 deletions .github/workflows/test_1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: test 1

on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2

jobs:
test-1:
env:
py38: 3.8
py39: 3.9
py310: "3.10"
py311: "3.11"
pypy3: pypy-3.8
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
python-version: [py38, py39, py310, py311, pypy3]
package:
- "resource/opentelemetry-resource-detector-container"
- "sdk-extension/opentelemetry-sdk-extension-aws"
os: [ubuntu-20.04]
exclude:
- python-version: py311
package: "prometheus-remote-write"
- python-version: pypy3
package: "prometheus-remote-write"
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v5
with:
python-version: ${{ env[matrix.python-version] }}
- name: Install tox
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v4
with:
path: |
.tox
~/.cache/pip
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -c ${{ matrix.package }}/tox.ini -e test-${{ matrix.python-version }} -- -ra
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ venv*/
# Installer logs
pip-log.txt

# Unit test / coverage reports
# Unit test / coverage, benchmark reports
coverage.xml
.coverage
.nox
.tox
.cache
htmlcov
benchmark.json

# Translations
*.mo
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ profile=black
; docs: https://github.com/timothycrosley/isort#multi-line-output-modes
multi_line_output=3
skip=target
skip_glob=**/gen/*,.venv*/*,venv*/*,.tox/*
skip_glob=**/gen/*,.venv*/*,venv*/*,.tox/*,**/.tox/*
known_first_party=opentelemetry
known_third_party=psutil,pytest,redis,redis_opentracing
2 changes: 2 additions & 0 deletions coverage-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage==7.5.1
pytest-cov==5.0.0
20 changes: 20 additions & 0 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
astroid==3.1.0
black==24.4.2
click==8.1.7
Deprecated==1.2.14
dill==0.3.8
flake8==7.0.0
importlib-metadata==7.0.0
isort==5.13.2
mccabe==0.7.0
mypy-extensions==1.0.0
packaging==24.0
pathspec==0.12.1
platformdirs==4.2.1
pycodestyle==2.11.1
pyflakes==3.2.0
pylint==3.1.0
tomlkit==0.12.4
typing_extensions==4.11.0
wrapt==1.16.0
zipp==3.18.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ packaging==24.0
pluggy==1.5.0
py-cpuinfo==9.0.0
pytest==7.4.4
pytest-benchmark==4.0.0
tomli==2.0.1
typing_extensions==4.10.0
wrapt==1.16.0
zipp==3.17.0
-e resource/opentelemetry-resource-detector-container
48 changes: 48 additions & 0 deletions resource/opentelemetry-resource-detector-container/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[tox]
isolated_build = True
skipsdist = True
skip_missing_interpreters = True
envlist =
test-py3{8,9,10,11}
test-pypy3
lint
coverage
spellcheck

[testenv]
setenv =
; override CORE_REPO_SHA via env variable when testing other branches/commits than main
; i.e: CORE_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e <env to test>
CORE_REPO_SHA={env:CORE_REPO_SHA:main}
CORE_REPO=git+https://github.com/open-telemetry/opentelemetry-python.git@{env:CORE_REPO_SHA}

commands_pre =
test,lint,coverage: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api
test,lint,coverage: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions
test,lint,coverage: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk
test,lint,coverage: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils
test,lint,coverage: pip install -e .

test,coverage: pip install -r {toxinidir}/test-requirements.txt

lint: pip install -r {toxinidir}/../../lint-requirements.txt

coverage: pip install -r {toxinidir}/../../coverage-requirements.txt

spellcheck: pip install -r {toxinidir}/../../spellcheck-requirements.txt

commands =
test: pytest {toxinidir}/tests {posargs}

lint: black --diff --check --config {toxinidir}/../../pyproject.toml {toxinidir}
lint: isort --diff --check-only --settings-path {toxinidir}/../../.isort.cfg {toxinidir}
lint: flake8 --config {toxinidir}/../../.flake8 {toxinidir}
lint: pylint --rcfile={toxinidir}/../../.pylintrc {toxinidir}/src/opentelemetry
lint: pylint --rcfile={toxinidir}/../../.pylintrc {toxinidir}/tests

coverage: coverage erase
coverage: pytest --cov={toxinidir}/src --cov-append --cov-branch --cov-report='' {toxinidir}/tests
coverage: coverage report --show-missing
coverage: coverage xml

spellcheck: codespell --config {toxinidir}/../../.codespellrc {toxinidir}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest-benchmark==4.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ packaging==24.0
pluggy==1.5.0
py-cpuinfo==9.0.0
pytest==7.4.4
pytest-benchmark==4.0.0
tomli==2.0.1
typing_extensions==4.10.0
wrapt==1.16.0
zipp==3.17.0
-e sdk-extension/opentelemetry-sdk-extension-aws
52 changes: 52 additions & 0 deletions sdk-extension/opentelemetry-sdk-extension-aws/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[tox]
isolated_build = True
skipsdist = True
skip_missing_interpreters = True
envlist =
test-py3{8,9,10,11}
test-pypy3
lint
coverage
spellcheck

[testenv]
setenv =
; override CORE_REPO_SHA via env variable when testing other branches/commits than main
; i.e: CORE_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e <env to test>
CORE_REPO_SHA={env:CORE_REPO_SHA:main}
CORE_REPO=git+https://github.com/open-telemetry/opentelemetry-python.git@{env:CORE_REPO_SHA}

commands_pre =
test,lint,coverage,benchmark: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api
test,lint,coverage,benchmark: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions
test,lint,coverage,benchmark: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk
test,lint,coverage,benchmark: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils
test,lint,coverage,benchmark: pip install -e .

test,coverage,benchmark: pip install -r {toxinidir}/test-requirements.txt

lint: pip install -r {toxinidir}/../../lint-requirements.txt

coverage: pip install -r {toxinidir}/../../coverage-requirements.txt

spellcheck: pip install -r {toxinidir}/../../spellcheck-requirements.txt

benchmark: pip install -r {toxinidir}/benchmark-requirements.txt

commands =
test: pytest {toxinidir}/tests {posargs}

lint: black --diff --check --config {toxinidir}/../../pyproject.toml {toxinidir}
lint: isort --diff --check-only --settings-path {toxinidir}/../../.isort.cfg {toxinidir}
lint: flake8 --config {toxinidir}/../../.flake8 {toxinidir}
lint: pylint --rcfile={toxinidir}/../../.pylintrc {toxinidir}/src/opentelemetry
lint: pylint --rcfile={toxinidir}/../../.pylintrc {toxinidir}/tests

coverage: coverage erase
coverage: pytest --cov={toxinidir}/src --cov-append --cov-branch --cov-report='' {toxinidir}/tests
coverage: coverage report --show-missing
coverage: coverage xml

spellcheck: codespell --config {toxinidir}/../../.codespellrc {toxinidir}

benchmark: pytest {toxinidir}/benchmarks --benchmark-json=benchmark.json
1 change: 1 addition & 0 deletions spellcheck-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codespell==2.2.6
Loading

0 comments on commit d2c7234

Please sign in to comment.