Skip to content

ci: smoke-test examples in CI and keep their versions in sync - #358

Merged
vmihailenco merged 4 commits into
masterfrom
ci/examples
Nov 1, 2026
Merged

vmihailenco merged 4 commits into
masterfrom
ci/examples

Conversation

@vmihailenco

Copy link
Copy Markdown
Member

Nothing ran the examples before, so they went stale without anyone noticing (e.g. #357). This adds a CI workflow that installs and runs every example, plus a script that keeps their uptrace/OpenTelemetry pins in sync with pyproject.toml.

CI

  • scripts/run_example.py NAME installs (--install) and smoke-tests an example against the local uptrace source:
    • scripts must exit 0
    • long-running metrics examples must stay alive
    • servers must answer 200 on their URLs; fastapi also runs its client
  • scripts/sync_examples.py rewrites the uptrace / opentelemetry-* pins in example/*/requirements.txt; CI runs it with --check. It replaces the manual step in RELEASING.md.
  • .github/workflows/examples.yml runs on PRs, on master and weekly, with one matrix job per example; Postgres is a service container for django-postgresql.
  • Dependabot now updates third-party example deps (grouped). It ignores uptrace/OpenTelemetry, which the sync script owns.
  • make examples runs everything locally, each example in its own venv under .venv-examples/.

Bugs it found

  • Library: uptrace.shutdown() raised AttributeError when Uptrace is disabled (no DSN), which crashed example/basic. Fixed, with a regression test.
  • fastapi, pyramid: pip install uptrace==1.45.0 opentelemetry-instrumentation-pyramid==0.66b0 fails to resolve unless opentelemetry-instrumentation-logging==0.66b0 is pinned too. Pinned it, as the other examples already do.
  • pyramid 2.0.2 imports pkg_resources, which current setuptools no longer has → bumped to 2.1.
  • django-postgresql: psycopg2==2.9.5 needs pg_config to build → psycopg2-binary.
  • otlp-traces-http passed headers as a tuple; the HTTP exporter needs a dict, so it crashed even with a DSN.

Testing

  • All examples except django-postgresql pass locally in fresh venvs, inside an isolated network namespace. django-postgresql is left to CI.
  • make test passes.

Without a DSN the global providers are no-op proxies without shutdown(),
so example/basic crashed with AttributeError.
…s-http run

- fastapi, pyramid: pin opentelemetry-instrumentation-logging, otherwise pip
  picks 0.66b2 and fails to resolve against the 0.66b0 instrumentations
- pyramid: bump to 2.1; 2.0.2 imports pkg_resources removed from setuptools
- django-postgresql: use psycopg2-binary so no pg_config is needed
- otlp-traces-http: the HTTP exporter takes headers as a dict
- scripts/run_example.py installs and runs each example (script, daemon or
  HTTP server checks) against the local uptrace source
- scripts/sync_examples.py syncs uptrace/OpenTelemetry pins from
  pyproject.toml; CI runs it with --check
- examples workflow runs on PRs, master and weekly
- dependabot updates third-party example deps
…arden example runner

- force_flush() had the same no-op proxy issue as shutdown()
- run_example.py: report a missing command or a connection error as a
  failure with output, always kill the whole process group, don't leak
  the temporary requirements file
- examples workflow: read-only token
@vmihailenco
vmihailenco merged commit 444c311 into master Nov 1, 2026
19 checks passed
@vmihailenco
vmihailenco deleted the ci/examples branch November 1, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant