Skip to content

Commit 5500c44

Browse files
authored
Merge branch 'main' into feat/strarlette_exclude_spans
2 parents f2cbeb0 + 7bfb756 commit 5500c44

9 files changed

Lines changed: 48 additions & 36 deletions

File tree

.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ jobs:
6868
- name: Install tox
6969
run: pip install tox-uv
7070

71+
{%- if job_data == "docker-tests" %}
72+
73+
- name: Install Microsoft SQL ODBC driver
74+
run: sudo apt update -y && ACCEPT_EULA=Y sudo apt install -y msodbcsql18 unixodbc-dev unixodbc
75+
{%- endif %}
76+
7177
- name: Run tests
7278
run: tox -e {{ job_data }}
7379
{%- if job_data == "generate-workflows" %}

.github/workflows/misc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
- name: Install tox
6060
run: pip install tox-uv
6161

62+
- name: Install Microsoft SQL ODBC driver
63+
run: sudo apt update -y && ACCEPT_EULA=Y sudo apt install -y msodbcsql18 unixodbc-dev unixodbc
64+
6265
- name: Run tests
6366
run: tox -e docker-tests
6467

CHANGELOG.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
## Unreleased
1313

1414
### Added
15+
1516
- Add `BaggageLogProcessor` to `opentelemetry-processor-baggage`
1617
([#4371](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4371))
17-
1818
- `opentelemetry-instrumentation-system-metrics`: Add support for `process.disk.io` metric in system-metrics instrumentation
19-
([#4397](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4397))
19+
([#4397](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4397))
2020
- Switch to SPDX license headers and add CI enforcement
2121
([#4533](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4533))
2222
- Bump `pylint` to `4.0.5`
@@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
([#3839](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3839))
3232
- `opentelemetry-exporter-richconsole`: Add support for suppressing resource information
3333
([#3898](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3898))
34+
- `opentelemetry-instrumentation`: Add experimental metrics attributes Labeler utility
35+
([#4288](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4288))
3436

3537
### Fixed
3638

@@ -46,13 +48,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4648
([#4360](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4360))
4749
- `opentelemetry-instrumentation-aiohttp-server`: Use `canonical` attribute of the `Resource` as a span name
4850
([#3896](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3896))
51+
- `docker-tests`: Don't require sudo, debian based distro and MS SQL ODBC driver to run locally. Instead require docker and unixodbc
52+
([#4478](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4478))
4953
- Refactor unit tests to allow for population of the random trace id flag in the `traceparent` header
5054
([#4030](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4030))
55+
- `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
56+
([#4368](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4368))
57+
- `opentelemetry-instrumentation-celery`: Coerce timelimit values to strings in `set_attributes_from_context()` to prevent mixed-type span attribute warning
58+
([#4361](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4361))
59+
- `opentelemetry-instrumentation-mysqlclient`: Update unit tests to properly validate trace context trace flag values.
60+
([#4560](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4560))
5161

5262
### Breaking changes
5363

5464
- Drop Python 3.9 support
5565
([#4412](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4412))
66+
- `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.
67+
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.
68+
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.
69+
([#4372](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4372))
5670

5771
## Version 1.41.0/0.62b0 (2026-04-09)
5872

@@ -72,13 +86,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7286
([#4049](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4049))
7387
- `opentelemetry-instrumentation-sqlalchemy`: implement new semantic convention opt-in migration
7488
([#4110](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4110))
75-
- `opentelemetry-instrumentation`: Add experimental metrics attributes Labeler utility
76-
([#4288](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4288))
7789

7890
### Fixed
7991

80-
- `opentelemetry-instrumentation-celery`: Coerce timelimit values to strings in `set_attributes_from_context()` to prevent mixed-type span attribute warning
81-
([#4361](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4361))
8292
- `opentelemetry-docker-tests`: Replace deprecated `SpanAttributes` from `opentelemetry.semconv.trace` with `opentelemetry.semconv._incubating.attributes`
8393
([#4339](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4339))
8494
- `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
@@ -93,8 +103,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
93103
([#4302](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4302))
94104
- `opentelemetry-instrumentation-grpc`: Fix bidirectional streaming RPCs raising `AttributeError: 'generator' object has no attribute 'add_done_callback'`
95105
([#4259](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4259))
96-
- `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
97-
([#4368](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4368))
98106
- `opentelemetry-instrumentation-aiokafka`: fix `Unclosed AIOKafkaProducer` warning and `RuntimeWarning: coroutine was never awaited` in tests
99107
([#4384](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4384))
100108
- `opentelemetry-instrumentation-aiokafka`: Fix compatibility with aiokafka 0.13 by calling
@@ -106,10 +114,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
106114

107115
- `opentelemetry-instrumentation-boto`: Remove instrumentation
108116
([#4303](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4303))
109-
- `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.
110-
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.
111-
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.
112-
([#4372](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4372))
113117

114118
## Version 1.40.0/0.61b0 (2026-03-04)
115119

instrumentation/opentelemetry-instrumentation-mysqlclient/tests/test_mysqlclient_integration.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled(self):
143143
span = spans_list[0]
144144
span_id = format(span.get_span_context().span_id, "016x")
145145
trace_id = format(span.get_span_context().trace_id, "032x")
146+
trace_flags = format(span.get_span_context().trace_flags, "02x")
146147
self.assertEqual(
147148
mock_cursor.execute.call_args[0][0],
148-
f"Select 1 /*db_driver='MySQLdb%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
149+
f"Select 1 /*db_driver='MySQLdb%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-{trace_flags}'*/;",
149150
)
150151
self.assertEqual(
151152
span.attributes[DB_STATEMENT],
@@ -194,7 +195,7 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled_stmt_enabled(
194195
)
195196
self.assertEqual(
196197
span.attributes[DB_STATEMENT],
197-
f"Select 1 /*db_driver='MySQLdb%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
198+
f"Select 1 /*db_driver='MySQLdb%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-{trace_flags}'*/;",
198199
)
199200

200201
def test_instrument_connection_with_dbapi_sqlcomment_enabled_with_options(
@@ -391,7 +392,7 @@ def test_instrument_with_dbapi_sqlcomment_enabled_stmt_enabled(
391392
)
392393
self.assertEqual(
393394
span.attributes[DB_STATEMENT],
394-
f"Select 1 /*db_driver='MySQLdb%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
395+
f"Select 1 /*db_driver='MySQLdb%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-{trace_flags}'*/;",
395396
)
396397

397398
def test_instrument_with_dbapi_sqlcomment_enabled_with_options(

tests/opentelemetry-docker-tests/tests/check_availability.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ def check_docker_services_availability():
130130
check_mysql_connection()
131131
check_postgres_connection()
132132
check_redis_connection()
133-
check_mssql_connection()
134-
setup_mssql_db()
133+
134+
# make accepting EULA for ms sql odbc driver optional
135+
if "ODBC Driver 18 for SQL Server" in pyodbc.drivers():
136+
check_mssql_connection()
137+
setup_mssql_db()
135138

136139

137140
check_docker_services_availability()

tests/opentelemetry-docker-tests/tests/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
otmongo:
53
ports:

tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55

6+
import pyodbc
67
import pytest
78
from sqlalchemy.exc import ProgrammingError
89

@@ -30,6 +31,10 @@
3031
}
3132

3233

34+
@pytest.mark.skipif(
35+
"ODBC Driver 18 for SQL Server" not in pyodbc.drivers(),
36+
reason="No MS SQL ODBC driver installed",
37+
)
3338
class MssqlConnectorTestCase(SQLAlchemyTestMixin):
3439
"""TestCase for pyodbc engine"""
3540

tests/opentelemetry-docker-tests/tests/test-requirements.txt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ amqp==5.2.0
33
asgiref==3.8.1
44
async-timeout==4.0.3
55
asyncpg==0.29.0
6-
attrs==23.2.0
76
bcrypt==5.0.0
87
billiard==4.2.0
98
celery==5.3.6
@@ -15,21 +14,15 @@ click-didyoumean==0.3.0
1514
click-plugins==1.1.1
1615
click-repl==0.3.0
1716
cryptography==46.0.7
18-
distro==1.9.0
1917
Django==4.2.30
2018
dnspython==2.6.1
21-
docker==5.0.3
22-
docker-compose==1.29.2
23-
dockerpty==0.4.1
24-
docopt==0.6.2
2519
exceptiongroup==1.2.0
2620
flaky==3.7.0
2721
flask==3.1.3
2822
greenlet==3.0.3
2923
grpcio==1.63.2
3024
idna==3.7
3125
iniconfig==2.0.0
32-
jsonschema==3.2.0
3326
kombu==5.3.5
3427
mysql-connector-python==8.3.0
3528
mysqlclient==2.1.1
@@ -50,24 +43,19 @@ PyMySQL==1.1.1
5043
PyNaCl==1.6.2
5144
# prerequisite: install unixodbc
5245
pyodbc==5.0.1
53-
pyrsistent==0.20.0
5446
pytest==8.0.2
5547
pytest-celery==0.0.0
5648
python-dateutil==2.9.0.post0
57-
python-dotenv==0.21.1
5849
pytz==2024.1
59-
PyYAML==5.3.1
6050
redis==5.0.1
6151
requests==2.31.0
6252
six==1.16.0
6353
SQLAlchemy==1.4.52
64-
texttable==1.7.0
6554
tomli==2.0.1
6655
typing_extensions==4.12.2
6756
tzdata==2024.1
68-
urllib3==1.26.19
57+
urllib3==2.6.3
6958
vine==5.1.0
7059
wcwidth==0.2.13
71-
websocket-client==0.59.0
7260
wrapt==1.16.0
7361
zipp==3.19.1

tox.ini

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,17 +1082,21 @@ deps =
10821082
changedir =
10831083
tests/opentelemetry-docker-tests/tests
10841084

1085+
allowlist_externals =
1086+
docker
1087+
pytest
1088+
10851089
commands_pre =
1086-
sh -c "sudo apt update -y && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev unixodbc"
1087-
python -c "import pyodbc; print(pyodbc.drivers())"
1088-
docker-compose up -d
1090+
docker --version || echo 'Docker with compose subcommand is required' && /bin/false
1091+
python -c 'import pyodbc; print(pyodbc.drivers())' || echo 'You need to install unixODBC' && /bin/false
1092+
docker compose up -d
10891093
python check_availability.py
10901094

10911095
commands =
10921096
pytest {posargs}
10931097

10941098
commands_post =
1095-
docker-compose down -v
1099+
docker compose down -v
10961100

10971101
[testenv:generate]
10981102
deps =

0 commit comments

Comments
 (0)