Skip to content

Commit e74a5e0

Browse files
Merge branch 'main' into feat/sqlcommenter-comment-position-dbapi
2 parents 469e935 + c87e487 commit e74a5e0

738 files changed

Lines changed: 6827 additions & 7596 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Switch to SPDX license headers (#4533)
2+
# TODO: update with the squash-merge commit SHA after merge

.github/labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
gen-ai:
2+
- changed-files:
3+
- any-glob-to-any-file:
4+
- 'instrumentation-genai/**'
5+
- 'util/opentelemetry-util-genai/**'
6+
- 'docs/instrumentation-genai/**'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Add PR to project board
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, ready_for_review]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
add-to-project:
12+
name: add to project board
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.draft == false
15+
steps:
16+
# NOTE: do NOT add an actions/checkout step here. This workflow uses
17+
# pull_request_target (which has access to secrets) but must never
18+
# execute code from the fork branch. See open-telemetry/opentelemetry-python#4955 for context.
19+
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
20+
id: otelbot-token
21+
with:
22+
app-id: ${{ vars.OTELBOT_PYTHON_APP_ID }}
23+
private-key: ${{ secrets.OTELBOT_PYTHON_PRIVATE_KEY }}
24+
25+
- uses: actions/add-to-project@v1.0.2
26+
with:
27+
project-url: https://github.com/orgs/open-telemetry/projects/88
28+
github-token: ${{ steps.otelbot-token.outputs.token }}

.github/workflows/check-links.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
steps:
3030
- name: Checkout Repo
3131
uses: actions/checkout@v6
32+
with:
33+
fetch-depth: 0
3234

3335
- name: Get changed markdown files
3436
id: changed-files
@@ -42,11 +44,41 @@ jobs:
4244
if: steps.changed-files.outputs.any_changed == 'true'
4345
run: npm install -g markdown-link-check@v3.12.2
4446

45-
- name: Run markdown-link-check
46-
if: steps.changed-files.outputs.any_changed == 'true'
47+
- name: Check links on push to main
48+
if: steps.changed-files.outputs.any_changed == 'true' && github.event_name == 'push'
4749
run: |
4850
markdown-link-check \
4951
--verbose \
5052
--config .github/workflows/check_links_config.json \
5153
${{ steps.changed-files.outputs.all_changed_files }} \
5254
|| { echo "Check that anchor links are lowercase"; exit 1; }
55+
56+
- name: Check new links only on pull requests
57+
if: steps.changed-files.outputs.any_changed == 'true' && github.event_name == 'pull_request'
58+
run: |
59+
# Extract URLs only from added lines in the diff to avoid
60+
# rate limiting when checking all links in large files like
61+
# CHANGELOG.md. Only new/changed links are checked on PRs;
62+
# pushes to main still check all links in changed files.
63+
git diff "origin/${{ github.base_ref }}...HEAD" -- \
64+
${{ steps.changed-files.outputs.all_changed_files }} \
65+
| grep '^+' | grep -v '^+++' \
66+
| grep -oP 'https?://[^\s\)\]\"'"'"'`>]+' \
67+
| sort -u > /tmp/new_links.txt
68+
69+
if [ ! -s /tmp/new_links.txt ]; then
70+
echo "No new links found in diff, skipping check"
71+
exit 0
72+
fi
73+
74+
echo "Checking $(wc -l < /tmp/new_links.txt) new links:"
75+
cat /tmp/new_links.txt
76+
77+
# Write links as markdown so markdown-link-check can parse them
78+
awk '{print "- <" $0 ">"}' /tmp/new_links.txt > /tmp/new_links.md
79+
80+
markdown-link-check \
81+
--verbose \
82+
--config .github/workflows/check_links_config.json \
83+
/tmp/new_links.md \
84+
|| { echo "Check that anchor links are lowercase"; exit 1; }

.github/workflows/labeler.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR Labeler
2+
3+
on:
4+
pull_request_target:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
label:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
steps:
16+
- uses: actions/labeler@v6
17+
with:
18+
sync-labels: false

.github/workflows/lint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,3 +1353,22 @@ jobs:
13531353

13541354
- name: Run tests
13551355
run: tox -e lint-opamp-client
1356+
1357+
lint-license-header-check:
1358+
name: license-header-check
1359+
runs-on: ubuntu-latest
1360+
timeout-minutes: 30
1361+
steps:
1362+
- name: Checkout repo @ SHA - ${{ github.sha }}
1363+
uses: actions/checkout@v4
1364+
1365+
- name: Set up Python 3.14
1366+
uses: actions/setup-python@v5
1367+
with:
1368+
python-version: "3.14"
1369+
1370+
- name: Install tox
1371+
run: pip install tox-uv
1372+
1373+
- name: Run tests
1374+
run: tox -e lint-license-header-check

.pre-commit-config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ repos:
1818
rev: 77490ffa33bfc0928975ae3cf904219903db755d # frozen: v6.2.5
1919
hooks:
2020
- id: rstcheck
21-
additional_dependencies: ['rstcheck[sphinx]']
21+
additional_dependencies:
22+
- rstcheck[sphinx]
23+
- rstcheck-core==1.3.0
2224
args: ["--report-level", "warning"]
25+
exclude: ^_template/autodoc_entry\.rst$

.pylintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ disable=missing-docstring,
8080
missing-module-docstring, # temp-pylint-upgrade
8181
import-error, # needed as a workaround as reported here: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/290
8282
cyclic-import,
83-
not-context-manager
83+
not-context-manager,
84+
attribute-defined-outside-init
8485

8586
# Enable the message, report, category or checker with the given id(s). You can
8687
# either give multiple identifier separated by comma (,) or put this option

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
([#4371](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4371))
1717
- `opentelemetry-instrumentation-dbapi`: Add `comment_position` option to `_add_sql_comment()` to support prepending sqlcommenter comment to the beginning of the query ([#4561](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4561))
1818

19+
- `opentelemetry-instrumentation-system-metrics`: Add support for `process.disk.io` metric in system-metrics instrumentation
20+
([#4397](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4397))
21+
- Switch to SPDX license headers and add CI enforcement
22+
([#4533](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4533))
1923
- Bump `pylint` to `4.0.5`
2024
([#4244](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4244))
2125
- `opentelemetry-instrumentation-sqlite3`: Add uninstrument, error status, suppress, and no-op tests
2226
([#4335](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4335))
2327
- Expand `AGENTS.md` with instrumentation/GenAI guidance and add PR review instructions.
2428
([#4457](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4457))
29+
- `opentelemetry-instrumentation-logging`: Add `OTEL_PYTHON_LOG_HANDLER_LEVEL` and `OTEL_PYTHON_LOG_FORMAT` environment variables to configure the log level and formatter of the auto-instrumented `LoggingHandler`.
30+
([#4298](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4298))
31+
- Remove redundant `pylint: disable=attribute-defined-outside-init` comments and add rule to global `.pylintrc` disable list
32+
([#3839](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3839))
33+
- `opentelemetry-exporter-richconsole`: Add support for suppressing resource information
34+
([#3898](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3898))
2535

2636
### Fixed
2737

@@ -37,6 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3747
([#4360](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4360))
3848
- `opentelemetry-instrumentation-aiohttp-server`: Use `canonical` attribute of the `Resource` as a span name
3949
([#3896](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3896))
50+
- Refactor unit tests to allow for population of the random trace id flag in the `traceparent` header
51+
([#4030](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4030))
4052

4153
### Breaking changes
4254

@@ -48,6 +60,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4860
### Added
4961
- `opentelemetry-instrumentation-dbapi`: Add `comment_position` option to `_add_sql_comment()` to support prepending sqlcommenter comment to the beginning of the query ([#4561](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4561))
5062

63+
- Enabled the flake8-tidy-import plugins rules for the ruff linter. These rules throw warnings for relative imports in the modules.
64+
([#4395](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4395))
5165
- `opentelemetry-instrumentation-asgi`: Respect `suppress_http_instrumentation` context in ASGI middleware to skip server span creation when HTTP instrumentation is suppressed
5266
([#4375](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4375))
5367
- `opentelemetry-instrumentation-confluent-kafka`: Loosen confluent-kafka upper bound to <3.0.0
@@ -60,9 +74,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6074
([#4049](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4049))
6175
- `opentelemetry-instrumentation-sqlalchemy`: implement new semantic convention opt-in migration
6276
([#4110](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4110))
77+
- `opentelemetry-instrumentation`: Add experimental metrics attributes Labeler utility
78+
([#4288](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4288))
6379

6480
### Fixed
6581

82+
- `opentelemetry-instrumentation-celery`: Coerce timelimit values to strings in `set_attributes_from_context()` to prevent mixed-type span attribute warning
83+
([#4361](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4361))
6684
- `opentelemetry-docker-tests`: Replace deprecated `SpanAttributes` from `opentelemetry.semconv.trace` with `opentelemetry.semconv._incubating.attributes`
6785
([#4339](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4339))
6886
- `opentelemetry-instrumentation-confluent-kafka`: Skip `recv` span creation when `poll()` returns no message or `consume()` returns an empty list, avoiding empty spans on idle polls
@@ -77,6 +95,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7795
([#4302](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4302))
7896
- `opentelemetry-instrumentation-grpc`: Fix bidirectional streaming RPCs raising `AttributeError: 'generator' object has no attribute 'add_done_callback'`
7997
([#4259](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4259))
98+
- `opentelemetry-instrumentation-fastapi`: Fix `FastAPI` instrumentation to correctly trace `BackgroundTasks` by wrapping their execution in a dedicated span, ensuring proper parent-child relationships and accurate trace timing
99+
([#4368](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4368))
80100
- `opentelemetry-instrumentation-aiokafka`: fix `Unclosed AIOKafkaProducer` warning and `RuntimeWarning: coroutine was never awaited` in tests
81101
([#4384](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4384))
82102
- `opentelemetry-instrumentation-aiokafka`: Fix compatibility with aiokafka 0.13 by calling
@@ -88,6 +108,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88108

89109
- `opentelemetry-instrumentation-boto`: Remove instrumentation
90110
([#4303](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4303))
111+
- `opentelemetry-instrumentation-logging`: Use `LogRecord.getMessage()` to format and extract each log record's body text to more closely match the expected usage of the logging system. As a result, all OTel log record bodies are now always strings.
112+
Previously, if `LogRecord.msg` (which contains the format string) was set to a non-string object (e.g. `logger.warning(some_dict)`), the object was exported as-is to the OTLP body field. Now, `LogRecord.getMessage()` will convert it to to a string.
113+
If you are passing in non-strings as the format string argument and your backend is expecting them as-is, you will need to update accordingly.
114+
([#4372](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4372))
91115

92116
## Version 1.40.0/0.61b0 (2026-03-04)
93117

CONTRIBUTING.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,13 @@ git commit
206206
git push fork feature
207207
```
208208

209-
Open a pull request against the main `opentelemetry-python-contrib` repo.
209+
Open a pull request (PR) against the main `opentelemetry-python-contrib` repo.
210+
211+
A descriptive PR title will help the community better triage and review your changes. Make sure to prefix with the name(s) of the package/subdirectory/domain that your PR updates. Following any of these examples will help:
212+
213+
* "opentelemetry-instrumentation-dbapi: add client operation duration metrics"
214+
* "GenAI Utils: Add _BaseAgent base class and agent creation lifecycle"
215+
* "docs(google-genai): document config recording environment variables"
210216

211217
### How to Receive Comments
212218

@@ -300,6 +306,16 @@ The continuous integration overrides that environment variable with as per the c
300306

301307
## Style Guide
302308

309+
* All Python files must include the following SPDX license header as the first
310+
two lines (or immediately after a shebang line):
311+
312+
```python
313+
# Copyright The OpenTelemetry Authors
314+
# SPDX-License-Identifier: Apache-2.0
315+
```
316+
317+
This is enforced by CI via `tox -e lint-license-header-check`.
318+
303319
* docstrings should adhere to the [Google Python Style
304320
Guide](http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings)
305321
as specified with the [napoleon

0 commit comments

Comments
 (0)