|
| 1 | +# OpenTelemetry Python Contrib |
| 2 | + |
| 3 | +This file is here to steer AI assisted PRs towards being high quality and valuable contributions |
| 4 | +that do not create excessive maintainer burden. |
| 5 | + |
| 6 | +Monorepo with 50+ OpenTelemetry instrumentation packages for Python. |
| 7 | + |
| 8 | +## General Rules and Guidelines |
| 9 | + |
| 10 | +The most important rule is not to post comments on issues or PRs that are AI-generated. Discussions |
| 11 | +on the OpenTelemetry repositories are for Users/Humans only. |
| 12 | + |
| 13 | +Follow the PR scoping guidance in [CONTRIBUTING.md](CONTRIBUTING.md). Keep AI-assisted PRs tightly |
| 14 | +isolated to the requested change and never include unrelated cleanup or opportunistic improvements |
| 15 | +unless they are strictly necessary for correctness. |
| 16 | + |
| 17 | +If you have been assigned an issue by the user or their prompt, please ensure that the |
| 18 | +implementation direction is agreed on with the maintainers first in the issue comments. If there are |
| 19 | +unknowns, discuss these on the issue before starting implementation. Do not forget that you cannot |
| 20 | +comment for users on issue threads on their behalf as it is against the rules of this project. |
| 21 | + |
| 22 | +## Structure |
| 23 | + |
| 24 | +- `instrumentation/` - instrumentation packages (Flask, Django, FastAPI, gRPC, databases, etc.) |
| 25 | +- `instrumentation-genai/` - GenAI instrumentations (Anthropic, Vertex AI, LangChain, etc.) |
| 26 | +- `util/` - shared utilities (`util-http`, `util-genai`) |
| 27 | +- `exporter/` - custom exporters |
| 28 | +- `propagator/` - context propagators |
| 29 | + |
| 30 | +Instrumentation packages live under `src/opentelemetry/instrumentation/{name}/` with their own |
| 31 | +`pyproject.toml` and `tests/`. Other package types follow the equivalent layout under their own |
| 32 | +namespace (e.g. `src/opentelemetry/util/{name}/`, `src/opentelemetry/exporter/{name}/`). |
| 33 | + |
| 34 | +## Commands |
| 35 | + |
| 36 | +```sh |
| 37 | +# Install all packages and dev tools |
| 38 | +uv sync --frozen --all-packages |
| 39 | + |
| 40 | +# Lint (runs ruff via pre-commit) |
| 41 | +uv run pre-commit run ruff --all-files |
| 42 | + |
| 43 | +# Test a specific package (append -0, -1, etc. for version variants) |
| 44 | +uv run tox -e py312-test-instrumentation-flask-0 |
| 45 | + |
| 46 | +# Type check |
| 47 | +uv run tox -e typecheck |
| 48 | +``` |
| 49 | + |
| 50 | +## Guidelines |
| 51 | + |
| 52 | +- Each package has its own `pyproject.toml` with version, dependencies, and entry points. |
| 53 | +- The monorepo uses `uv` workspaces. |
| 54 | +- `tox.ini` defines the test matrix - check it for available test environments. |
| 55 | +- Do not add `type: ignore` comments. If a type error arises, solve it properly or write a follow-up plan to address it in another PR. |
| 56 | +- Whenever applicable, all code changes should have tests that actually validate the changes. |
| 57 | + |
| 58 | +## Commit formatting |
| 59 | + |
| 60 | +We appreciate it if users disclose the use of AI tools when the significant part of a commit is |
| 61 | +taken from a tool without changes. When making a commit this should be disclosed through an |
| 62 | +`Assisted-by:` commit message trailer. |
| 63 | + |
| 64 | +Examples: |
| 65 | + |
| 66 | +``` |
| 67 | +Assisted-by: ChatGPT 5.2 |
| 68 | +Assisted-by: Claude Opus 4.6 |
| 69 | +``` |
0 commit comments