Skip to content

Commit 3a356ec

Browse files
authored
Merge branch 'main' into drogers-add-sanitize-class
2 parents ed7af56 + 318a3a3 commit 3a356ec

File tree

12 files changed

+133
-196
lines changed

12 files changed

+133
-196
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
([#1208](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1208))
2222
- `opentelemetry-instrumentation-aiohttp-client` Fix producing additional spans with each newly created ClientSession
2323
- ([#1246](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1246))
24+
- Add _is_openetlemetry_instrumented check in _InstrumentedFastAPI class
25+
([#1313](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1313))
2426

2527
## [1.12.0-0.33b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0-0.33b0) - 2022-08-08
2628

instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def __init__(self, *args, **kwargs):
247247
client_response_hook=_InstrumentedFastAPI._client_response_hook,
248248
tracer_provider=_InstrumentedFastAPI._tracer_provider,
249249
)
250+
self._is_instrumented_by_opentelemetry = True
250251

251252

252253
def _get_route_details(scope):

instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py

+8
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ def test_request(self):
274274
self.assertEqual(span.resource.attributes["key1"], "value1")
275275
self.assertEqual(span.resource.attributes["key2"], "value2")
276276

277+
def test_mulitple_way_instrumentation(self):
278+
self._instrumentor.instrument_app(self._app)
279+
count = 0
280+
for middleware in self._app.user_middleware:
281+
if middleware.cls is OpenTelemetryMiddleware:
282+
count += 1
283+
self.assertEqual(count, 1)
284+
277285
def tearDown(self):
278286
self._instrumentor.uninstrument()
279287
super().tearDown()

opentelemetry-distro/MANIFEST.in

-7
This file was deleted.

opentelemetry-distro/pyproject.toml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "opentelemetry-distro"
7+
dynamic = ["version"]
8+
description = "OpenTelemetry Python Distro"
9+
readme = "README.rst"
10+
license = "Apache-2.0"
11+
requires-python = ">=3.7"
12+
authors = [
13+
{ name = "OpenTelemetry Authors", email = "[email protected]" },
14+
]
15+
classifiers = [
16+
"Development Status :: 4 - Beta",
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: Apache Software License",
19+
"Programming Language :: Python",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.7",
22+
"Programming Language :: Python :: 3.8",
23+
"Typing :: Typed",
24+
]
25+
dependencies = [
26+
"opentelemetry-api ~= 1.12",
27+
"opentelemetry-instrumentation == 0.33b0",
28+
"opentelemetry-sdk == 1.12.0",
29+
]
30+
31+
[project.optional-dependencies]
32+
otlp = [
33+
"opentelemetry-exporter-otlp == 1.12.0",
34+
]
35+
test = []
36+
37+
[project.entry-points.opentelemetry_configurator]
38+
configurator = "opentelemetry.distro:OpenTelemetryConfigurator"
39+
40+
[project.entry-points.opentelemetry_distro]
41+
distro = "opentelemetry.distro:OpenTelemetryDistro"
42+
43+
[project.urls]
44+
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-distro"
45+
46+
[tool.hatch.version]
47+
path = "src/opentelemetry/distro/version.py"
48+
49+
[tool.hatch.build.targets.sdist]
50+
include = [
51+
"/src",
52+
"/tests",
53+
]
54+
55+
[tool.hatch.build.targets.wheel]
56+
packages = ["src/opentelemetry"]

opentelemetry-distro/setup.cfg

-59
This file was deleted.

opentelemetry-distro/setup.py

-27
This file was deleted.

opentelemetry-instrumentation/MANIFEST.in

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "opentelemetry-instrumentation"
7+
dynamic = ["version"]
8+
description = "Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python"
9+
readme = "README.rst"
10+
license = "Apache-2.0"
11+
requires-python = ">=3.7"
12+
authors = [
13+
{ name = "OpenTelemetry Authors", email = "[email protected]" },
14+
]
15+
classifiers = [
16+
"Development Status :: 4 - Beta",
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: Apache Software License",
19+
"Programming Language :: Python",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.7",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
]
26+
dependencies = [
27+
"opentelemetry-api ~= 1.4",
28+
"setuptools >= 16.0",
29+
"wrapt >= 1.0.0, < 2.0.0",
30+
]
31+
32+
[project.optional-dependencies]
33+
test = []
34+
35+
[project.scripts]
36+
opentelemetry-bootstrap = "opentelemetry.instrumentation.bootstrap:run"
37+
opentelemetry-instrument = "opentelemetry.instrumentation.auto_instrumentation:run"
38+
39+
[project.entry-points.opentelemetry_environment_variables]
40+
instrumentation = "opentelemetry.instrumentation.environment_variables"
41+
42+
[project.urls]
43+
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation"
44+
45+
[tool.hatch.version]
46+
path = "src/opentelemetry/instrumentation/version.py"
47+
48+
[tool.hatch.build.targets.sdist]
49+
include = [
50+
"/src",
51+
"/tests",
52+
]
53+
54+
[tool.hatch.build.targets.wheel]
55+
packages = ["src/opentelemetry"]

opentelemetry-instrumentation/setup.cfg

-59
This file was deleted.

opentelemetry-instrumentation/setup.py

-29
This file was deleted.

scripts/eachdist.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -518,18 +518,19 @@ def lint_args(args):
518518

519519
runsubprocess(
520520
args.dry_run,
521-
("black", ".") + (("--diff", "--check") if args.check_only else ()),
521+
("black", "--config", f"{rootdir}/pyproject.toml", ".")
522+
+ (("--diff", "--check") if args.check_only else ()),
522523
cwd=rootdir,
523524
check=True,
524525
)
525526
runsubprocess(
526527
args.dry_run,
527-
("isort", ".")
528+
("isort", "--settings-path", f"{rootdir}/.isort.cfg", ".")
528529
+ (("--diff", "--check-only") if args.check_only else ()),
529530
cwd=rootdir,
530531
check=True,
531532
)
532-
runsubprocess(args.dry_run, ("flake8", rootdir), check=True)
533+
runsubprocess(args.dry_run, ("flake8", "--config", f"{rootdir}/.flake8", rootdir), check=True)
533534
execute_args(
534535
parse_subargs(
535536
args, ("exec", "pylint {}", "--all", "--mode", "lintroots")
@@ -644,7 +645,7 @@ def update_dependencies(targets, version, packages):
644645

645646
update_files(
646647
targets,
647-
"setup.cfg",
648+
"pyproject.toml",
648649
fr"({package_name}.*)==(.*)",
649650
r"\1== " + version,
650651
)
@@ -717,13 +718,16 @@ def format_args(args):
717718
format_dir = str(find_projectroot())
718719
if args.path:
719720
format_dir = os.path.join(format_dir, args.path)
720-
721+
root_dir = str(find_projectroot())
721722
runsubprocess(
722-
args.dry_run, ("black", "."), cwd=format_dir, check=True,
723+
args.dry_run,
724+
("black", "--config", f"{root_dir}/pyproject.toml", "."),
725+
cwd=format_dir,
726+
check=True,
723727
)
724728
runsubprocess(
725729
args.dry_run,
726-
("isort", "--profile", "black", "."),
730+
("isort", "--settings-path", f"{root_dir}/.isort.cfg", "--profile", "black", "."),
727731
cwd=format_dir,
728732
check=True,
729733
)

0 commit comments

Comments
 (0)