Skip to content

Commit ed7af56

Browse files
authored
Merge branch 'main' into drogers-add-sanitize-class
2 parents 60b7006 + ff9651e commit ed7af56

File tree

44 files changed

+1185
-687
lines changed

Some content is hidden

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

44 files changed

+1185
-687
lines changed

Diff for: CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Flask sqlalchemy psycopg2 integration
12+
([#1224](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1224))
13+
1014
### Fixed
1115

1216
- `opentelemetry-instrumentation-boto3sqs` Make propagation compatible with other SQS instrumentations, add 'messaging.url' span attribute, and fix missing package dependencies.
13-
([#1234](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1234))
17+
([#1234](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1234))
18+
- `opentelemetry-instrumentation-pymongo` Change span names to not contain queries but only database name and command name
19+
([#1247](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1247))
1420
- restoring metrics in django framework
1521
([#1208](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1208))
1622
- `opentelemetry-instrumentation-aiohttp-client` Fix producing additional spans with each newly created ClientSession
@@ -26,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2632
([#1206](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1206))
2733
- Add psycopg2 native tags to sqlcommenter
2834
([#1203](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1203))
35+
- Deprecation of direction attribute for metrics. Addition of direction based metric names
36+
([#1214](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1214))
2937

3038
### Added
3139
- `opentelemetry-instrumentation-redis` add support to instrument RedisCluster clients

Diff for: _template/pyproject.toml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
# opentelemetry-instrumentation plus the name of the library being instrument e.g
7+
# name = "opentelemetry-instrumentation-sqlalchemy"
8+
name = "<REPLACE ME>"
9+
dynamic = ["version"]
10+
# a description of the instrumentation e.g
11+
# description = "SQLAlchemy tracing for OpenTelemetry"
12+
description = "<REPLACE ME>"
13+
readme = "README.rst"
14+
license = "Apache-2.0"
15+
requires-python = ">=3.7"
16+
authors = [
17+
{ name = "OpenTelemetry Authors", email = "[email protected]" },
18+
]
19+
classifiers = [
20+
"Development Status :: 4 - Beta",
21+
"Intended Audience :: Developers",
22+
"License :: OSI Approved :: Apache Software License",
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
]
30+
dependencies = [
31+
"opentelemetry-api ~= 1.12",
32+
]
33+
34+
[project.optional-dependencies]
35+
test = [
36+
# add any test dependencies here
37+
"<REPLACE ME>",
38+
]
39+
40+
[project.entry-points.opentelemetry_instrumentor]
41+
# REPLACE ME: the entrypoint for the instrumentor e.g
42+
# sqlalchemy = "opentelemetry.instrumentation.sqlalchemy:SQLAlchemyInstrumentor"
43+
<REPLACE ME> = "opentelemetry.instrumentation.<REPLACE>"
44+
45+
[project.urls]
46+
# url of the instrumentation e.g
47+
# Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-sqlalchemy"
48+
Homepage = "<REPLACE ME>"
49+
50+
[tool.hatch.version]
51+
# REPLACE ME: the path to the version file e.g
52+
# "src/opentelemetry/instrumentation/sqlalchemy/version.py"
53+
path = "src/opentelemetry/instrumentation/<REPLACE ME>/version.py"
54+
55+
[tool.hatch.build.targets.sdist]
56+
include = [
57+
"/src",
58+
"/tests",
59+
]
60+
61+
[tool.hatch.build.targets.wheel]
62+
packages = ["src/opentelemetry"]

Diff for: _template/setup.cfg

-58
This file was deleted.

Diff for: _template/setup.py

-42
This file was deleted.

Diff for: exporter/opentelemetry-exporter-datadog/setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ long_description = file: README.rst
1919
long_description_content_type = text/x-rst
2020
author = OpenTelemetry Authors
2121
author_email = [email protected]
22-
url = https://github.com/open-telemetry/opentelemetry-python-contrib/exporter/opentelemetry-exporter-datadog
22+
url = https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter/opentelemetry-exporter-datadog
2323
platforms = any
2424
license = Apache-2.0
2525
classifiers =

Diff for: exporter/opentelemetry-exporter-richconsole/setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ long_description = file: README.rst
1919
long_description_content_type = text/x-rst
2020
author = OpenTelemetry Authors
2121
author_email = [email protected]
22-
url = https://github.com/open-telemetry/opentelemetry-python-contrib/exporter/opentelemetry-exporter-richconsole
22+
url = https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/datadog_exporter
2323
platforms = any
2424
license = Apache-2.0
2525
classifiers =

Diff for: instrumentation/opentelemetry-instrumentation-aio-pika/setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ long_description = file: README.rst
1919
long_description_content_type = text/x-rst
2020
author = OpenTelemetry Authors
2121
author_email = [email protected]
22-
url = https://github.com/open-telemetry/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aio-pika
22+
url = https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aio-pika
2323
platforms = any
2424
license = Apache-2.0
2525
classifiers =

Diff for: instrumentation/opentelemetry-instrumentation-boto3sqs/setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ long_description_content_type = text/x-rst
2424
author = OpenTelemetry Authors
2525
author_email = [email protected]
2626
# url of the instrumentation e.g
27-
url = https://github.com/open-telemetry/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-boto3sqs
27+
url = https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-boto3sqs
2828
platforms = any
2929
license = Apache-2.0
3030
classifiers =

Diff for: instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545

4646
from opentelemetry import trace as trace_api
4747
from opentelemetry.instrumentation.dbapi.version import __version__
48+
from opentelemetry.instrumentation.sqlcommenter_utils import _add_sql_comment
4849
from opentelemetry.instrumentation.utils import (
49-
_add_sql_comment,
5050
_get_opentelemetry_values,
5151
unwrap,
5252
)

Diff for: instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py

+33
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import logging
1717
from unittest import mock
1818

19+
from opentelemetry import context
1920
from opentelemetry import trace as trace_api
2021
from opentelemetry.instrumentation import dbapi
2122
from opentelemetry.sdk import resources
@@ -254,6 +255,38 @@ def test_executemany_comment(self):
254255
r"Select 1 /\*dbapi_threadsafety=123,driver_paramstyle='test',libpq_version=123,traceparent='\d{1,2}-[a-zA-Z0-9_]{32}-[a-zA-Z0-9_]{16}-\d{1,2}'\*/;",
255256
)
256257

258+
def test_executemany_flask_integration_comment(self):
259+
260+
connect_module = mock.MagicMock()
261+
connect_module.__version__ = mock.MagicMock()
262+
connect_module.__libpq_version__ = 123
263+
connect_module.apilevel = 123
264+
connect_module.threadsafety = 123
265+
connect_module.paramstyle = "test"
266+
267+
db_integration = dbapi.DatabaseApiIntegration(
268+
"testname",
269+
"testcomponent",
270+
enable_commenter=True,
271+
commenter_options={"db_driver": False, "dbapi_level": False},
272+
connect_module=connect_module,
273+
)
274+
current_context = context.get_current()
275+
sqlcommenter_context = context.set_value(
276+
"SQLCOMMENTER_ORM_TAGS_AND_VALUES", {"flask": 1}, current_context
277+
)
278+
context.attach(sqlcommenter_context)
279+
280+
mock_connection = db_integration.wrapped_connection(
281+
mock_connect, {}, {}
282+
)
283+
cursor = mock_connection.cursor()
284+
cursor.executemany("Select 1;")
285+
self.assertRegex(
286+
cursor.query,
287+
r"Select 1 /\*dbapi_threadsafety=123,driver_paramstyle='test',flask=1,libpq_version=123,traceparent='\d{1,2}-[a-zA-Z0-9_]{32}-[a-zA-Z0-9_]{16}-\d{1,2}'\*/;",
288+
)
289+
257290
def test_callproc(self):
258291
db_integration = dbapi.DatabaseApiIntegration(
259292
"testname", "testcomponent"

Diff for: instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/sqlcommenter_middleware.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
from django.db import connections
2323
from django.db.backends.utils import CursorDebugWrapper
2424

25-
from opentelemetry.instrumentation.utils import (
26-
_add_sql_comment,
27-
_get_opentelemetry_values,
28-
)
25+
from opentelemetry.instrumentation.sqlcommenter_utils import _add_sql_comment
26+
from opentelemetry.instrumentation.utils import _get_opentelemetry_values
2927
from opentelemetry.trace.propagation.tracecontext import (
3028
TraceContextTextMapPropagator,
3129
)

0 commit comments

Comments
 (0)