Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/5337.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`opentelemetry-process-context`: implement process context publishing (OTEP-4719)
4 changes: 2 additions & 2 deletions .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,.git,./opentelemetry-semantic-conventions,*-requirements*.txt
ignore-words-list = ans,ue,ot,hist,ro,astroid
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git,./opentelemetry-semantic-conventions,*-requirements*.txt,./opentelemetry-process-context/rust/target
ignore-words-list = ans,ue,ot,hist,ro,astroid,crate
49 changes: 45 additions & 4 deletions .github/workflows/generate_workflows.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from collections import defaultdict
from pathlib import Path
from re import compile as re_compile
from re import fullmatch

from jinja2 import Environment, FileSystemLoader
from tox.config.cli.parse import get_options
from tox.config.main import Config
from tox.config.sets import CoreConfigSet
from tox.config.source.tox_ini import ToxIni
from tox.session.state import State
Expand All @@ -18,7 +20,7 @@
)


def get_tox_envs(tox_ini_path: Path) -> list:
def get_core_config_set(tox_ini_path: Path) -> tuple[Config, CoreConfigSet]:
tox_ini = ToxIni(tox_ini_path)

conf = State(get_options(), []).conf
Expand All @@ -40,11 +42,39 @@ def get_tox_envs(tox_ini_path: Path) -> list:
)
)

return core_config_set.load("env_list")
return conf, core_config_set


def get_tox_envs(tox_ini_path: Path) -> list:
return get_core_config_set(tox_ini_path)[1].load("env_list")


def get_env_platforms(tox_ini_path: Path) -> dict[str, str]:
conf, core_config_set = get_core_config_set(tox_ini_path)

platforms = {}

for env_name in core_config_set.load("env_list"):
env_config_set = conf.get_env(env_name)
env_config_set.add_config(
keys=["platform"],
of_type=str,
default="",
desc="platform constraint regex",
)
platforms[env_name] = env_config_set.load("platform")

return platforms

def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:

def get_test_job_datas(
tox_envs: list, operating_systems: list, env_platforms: dict[str, str]
) -> list:
os_alias = {"ubuntu-latest": "Ubuntu", "windows-latest": "Windows"}
os_sys_platform = {
"ubuntu-latest": "linux",
"windows-latest": "win32",
}

python_version_alias = {
"pypy3": "pypy-3.10",
Expand All @@ -59,12 +89,19 @@ def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:
test_job_datas = []

for operating_system in operating_systems:
sys_platform = os_sys_platform[operating_system]

for tox_env in tox_envs:
tox_test_env_match = _tox_test_env_regex.match(tox_env)

if tox_test_env_match is None:
continue

if (platform := env_platforms.get(tox_env, "")) and not fullmatch(
platform, sys_platform
):
continue

groups = tox_test_env_match.groupdict()

aliased_python_version = python_version_alias[
Expand Down Expand Up @@ -156,7 +193,11 @@ def generate_test_workflow(
tox_ini_path: Path, workflow_directory_path: Path, operating_systems
) -> None:
_generate_workflow(
get_test_job_datas(get_tox_envs(tox_ini_path), operating_systems),
get_test_job_datas(
get_tox_envs(tox_ini_path),
operating_systems,
get_env_platforms(tox_ini_path),
),
"test",
workflow_directory_path,
)
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,25 @@ jobs:
- name: Run tests
run: tox -e lint-opentelemetry-exporter-zipkin-json

lint-opentelemetry-process-context:
name: opentelemetry-process-context
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -e lint-opentelemetry-process-context

lint-opentelemetry-propagator-b3:
name: opentelemetry-propagator-b3
runs-on: ubuntu-latest
Expand Down
71 changes: 67 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,60 @@ permissions:
contents: read

jobs:
build-process-context-wheels:
name: process-context wheels (${{ matrix.platform.target }} ${{ matrix.platform.manylinux }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
# manylinux
- { target: x86_64, manylinux: auto }
- { target: x86, manylinux: auto }
- { target: aarch64, manylinux: auto }
- { target: armv7, manylinux: auto }
- { target: ppc64le, manylinux: auto }
- { target: s390x, manylinux: auto }
# musllinux
- { target: x86_64, manylinux: musllinux_1_2 }
- { target: x86, manylinux: musllinux_1_2 }
- { target: aarch64, manylinux: musllinux_1_2 }
- { target: armv7, manylinux: musllinux_1_2 }
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Build wheels
uses: PyO3/maturin-action@3e2bdf6ba6453a61e649744019b8a2d906c7eb38 # v1.51.0
with:
target: ${{ matrix.platform.target }}
manylinux: ${{ matrix.platform.manylinux }}
args: --release --out dist --manifest-path opentelemetry-process-context/rust/Cargo.toml
sccache: 'true'

- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: process-context-wheels-${{ matrix.platform.target }}-${{ matrix.platform.manylinux }}
path: dist

build-process-context-sdist:
name: process-context sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Build sdist
uses: PyO3/maturin-action@3e2bdf6ba6453a61e649744019b8a2d906c7eb38 # v1.51.0
with:
command: sdist
args: --out dist --manifest-path opentelemetry-process-context/rust/Cargo.toml

- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: process-context-sdist
path: dist

release:
needs: [build-process-context-wheels, build-process-context-sdist]
permissions:
contents: write # required for creating GitHub releases
runs-on: ubuntu-latest
Expand All @@ -17,7 +70,7 @@ jobs:
exit 1
fi

- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install toml
run: pip install toml
Expand Down Expand Up @@ -64,21 +117,31 @@ jobs:

# check out main branch to verify there won't be problems with merging the change log
# at the end of this workflow
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: main

# back to the release branch
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

# next few steps publish to pypi
- uses: actions/setup-python@v5
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.10'

- name: Build wheels
run: ./scripts/build.sh

# Native wheels + sdist for opentelemetry-process-context, built by the
# build-process-context-* jobs above are merged into dist/ so the twine
# uploads below publish them alongside the pure Python packages.
- name: Download process-context wheels and sdist
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: process-context-*
merge-multiple: true
path: dist

- name: Install twine
run: |
pip install twine
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3086,6 +3086,120 @@ jobs:
- name: Run tests
run: tox -e pypy3-test-opentelemetry-exporter-zipkin-json -- -ra

py310-test-opentelemetry-process-context_ubuntu-latest:
name: opentelemetry-process-context 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
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-uv

- name: Run tests
run: tox -e py310-test-opentelemetry-process-context -- -ra

py311-test-opentelemetry-process-context_ubuntu-latest:
name: opentelemetry-process-context 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
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-uv

- name: Run tests
run: tox -e py311-test-opentelemetry-process-context -- -ra

py312-test-opentelemetry-process-context_ubuntu-latest:
name: opentelemetry-process-context 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
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-uv

- name: Run tests
run: tox -e py312-test-opentelemetry-process-context -- -ra

py313-test-opentelemetry-process-context_ubuntu-latest:
name: opentelemetry-process-context 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -e py313-test-opentelemetry-process-context -- -ra

py314-test-opentelemetry-process-context_ubuntu-latest:
name: opentelemetry-process-context 3.14 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -e py314-test-opentelemetry-process-context -- -ra

py314t-test-opentelemetry-process-context_ubuntu-latest:
name: opentelemetry-process-context 3.14t Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.14t
uses: actions/setup-python@v5
with:
python-version: "3.14t"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -e py314t-test-opentelemetry-process-context -- -ra

py310-test-opentelemetry-propagator-b3_ubuntu-latest:
name: opentelemetry-propagator-b3 3.10 Ubuntu
runs-on: ubuntu-latest
Expand Down
Loading
Loading