Skip to content

Commit 7aed1af

Browse files
authored
Merge branch 'open-telemetry:main' into fix/1477
2 parents a202550 + ad29af3 commit 7aed1af

File tree

9 files changed

+37
-7
lines changed

9 files changed

+37
-7
lines changed

Diff for: .github/workflows/lint_0.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
CORE_REPO_SHA: opentelemetrybot/update-version-to-1.32.0.dev-0.53b0.dev
13+
CORE_REPO_SHA: main
1414
CONTRIB_REPO_SHA: main
1515
PIP_EXISTS_ACTION: w
1616

Diff for: .github/workflows/misc_0.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
CORE_REPO_SHA: opentelemetrybot/update-version-to-1.32.0.dev-0.53b0.dev
13+
CORE_REPO_SHA: main
1414
CONTRIB_REPO_SHA: main
1515
PIP_EXISTS_ACTION: w
1616

Diff for: .github/workflows/test_0.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
CORE_REPO_SHA: opentelemetrybot/update-version-to-1.32.0.dev-0.53b0.dev
13+
CORE_REPO_SHA: main
1414
CONTRIB_REPO_SHA: main
1515
PIP_EXISTS_ACTION: w
1616

Diff for: .github/workflows/test_1.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
CORE_REPO_SHA: opentelemetrybot/update-version-to-1.32.0.dev-0.53b0.dev
13+
CORE_REPO_SHA: main
1414
CONTRIB_REPO_SHA: main
1515
PIP_EXISTS_ACTION: w
1616

Diff for: .github/workflows/test_2.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
CORE_REPO_SHA: opentelemetrybot/update-version-to-1.32.0.dev-0.53b0.dev
13+
CORE_REPO_SHA: main
1414
CONTRIB_REPO_SHA: main
1515
PIP_EXISTS_ACTION: w
1616

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4949
([#3249](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3249))
5050
- `opentelemetry-instrumentation-asyncpg` Fix fallback for empty queries.
5151
([#3253](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3253))
52+
- `opentelemetry-instrumentation` Fix a traceback in sqlcommenter when psycopg connection pooling is enabled.
53+
([#3309](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3309))
5254
- `opentelemetry-instrumentation-threading` Fix broken context typehints
5355
([#3322](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3322))
5456
- `opentelemetry-instrumentation-requests` always record span status code in duration metric

Diff for: instrumentation/opentelemetry-instrumentation-django/tests/test_sqlcommenter.py

+28
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,31 @@ def test_multiple_connection_support(self, query_wrapper):
178178

179179
# check if query_wrapper is added to the context for 2 databases
180180
self.assertEqual(query_wrapper.call_count, 2)
181+
182+
@patch(
183+
"opentelemetry.instrumentation.django.middleware.sqlcommenter_middleware._get_opentelemetry_values"
184+
)
185+
def test_empty_sql(self, trace_capture):
186+
requests_mock = MagicMock()
187+
requests_mock.resolver_match.view_name = "view"
188+
requests_mock.resolver_match.route = "route"
189+
requests_mock.resolver_match.app_name = "app"
190+
191+
trace_capture.return_value = {
192+
"traceparent": "*traceparent='00-000000000000000000000000deadbeef-000000000000beef-00"
193+
}
194+
qw_instance = _QueryWrapper(requests_mock)
195+
execute_mock_obj = MagicMock()
196+
qw_instance(
197+
execute_mock_obj,
198+
"",
199+
MagicMock("test"),
200+
MagicMock("test1"),
201+
MagicMock(),
202+
)
203+
output_sql = execute_mock_obj.call_args[0][0]
204+
self.assertEqual(
205+
output_sql,
206+
" /*app_name='app',controller='view',route='route',traceparent='%%2Atraceparent%%3D%%2700-0000000"
207+
"00000000000000000deadbeef-000000000000beef-00'*/",
208+
)

Diff for: opentelemetry-instrumentation/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ The above command will configure the global trace provider to use the Random IDs
131131
pass ``--port=3000`` to ``flask run``.
132132

133133
Programmatic Auto-instrumentation
134-
--------------------
134+
---------------------------------
135135

136136
::
137137

Diff for: opentelemetry-instrumentation/src/opentelemetry/instrumentation/sqlcommenter_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _add_sql_comment(sql, **meta) -> str:
2323
meta.update(**_add_framework_tags())
2424
comment = _generate_sql_comment(**meta)
2525
sql = sql.rstrip()
26-
if sql[-1] == ";":
26+
if sql.endswith(";"):
2727
sql = sql[:-1] + comment + ";"
2828
else:
2929
sql = sql + comment

0 commit comments

Comments
 (0)