Skip to content

Commit

Permalink
Merge branch 'main' into aws_ecs_detector
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Mancioppi committed Sep 12, 2022
2 parents 43a5b59 + 318a3a3 commit b91d370
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 203 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -16,11 +16,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- `opentelemetry-instrumentation-boto3sqs` Make propagation compatible with other SQS instrumentations, add 'messaging.url' span attribute, and fix missing package dependencies.
([#1234](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1234))
([#1234](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1234))
- `opentelemetry-instrumentation-pymongo` Change span names to not contain queries but only database name and command name
([#1247](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1247))
- restoring metrics in django framework
([#1208](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1208))
- `opentelemetry-instrumentation-aiohttp-client` Fix producing additional spans with each newly created ClientSession
- ([#1246](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1246))
- Add _is_openetlemetry_instrumented check in _InstrumentedFastAPI class
([#1313](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1313))

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

Expand Down
Expand Up @@ -247,6 +247,7 @@ def __init__(self, *args, **kwargs):
client_response_hook=_InstrumentedFastAPI._client_response_hook,
tracer_provider=_InstrumentedFastAPI._tracer_provider,
)
self._is_instrumented_by_opentelemetry = True


def _get_route_details(scope):
Expand Down
Expand Up @@ -274,6 +274,14 @@ def test_request(self):
self.assertEqual(span.resource.attributes["key1"], "value1")
self.assertEqual(span.resource.attributes["key2"], "value2")

def test_mulitple_way_instrumentation(self):
self._instrumentor.instrument_app(self._app)
count = 0
for middleware in self._app.user_middleware:
if middleware.cls is OpenTelemetryMiddleware:
count += 1
self.assertEqual(count, 1)

def tearDown(self):
self._instrumentor.uninstrument()
super().tearDown()
Expand Down
Expand Up @@ -121,10 +121,10 @@ def started(self, event: monitoring.CommandStartedEvent):
):
return
command = event.command.get(event.command_name, "")
name = event.command_name
name = event.database_name
name += "." + event.command_name
statement = event.command_name
if command:
name += "." + str(command)
statement += " " + str(command)

try:
Expand Down
Expand Up @@ -40,7 +40,6 @@ def test_pymongo_instrumentor(self):
)
with patch:
PymongoInstrumentor().instrument()

self.assertTrue(mock_register.called)

def test_started(self):
Expand All @@ -59,7 +58,7 @@ def test_started(self):
# pylint: disable=protected-access
span = command_tracer._pop_span(mock_event)
self.assertIs(span.kind, trace_api.SpanKind.CLIENT)
self.assertEqual(span.name, "command_name.find")
self.assertEqual(span.name, "database_name.command_name")
self.assertEqual(span.attributes[SpanAttributes.DB_SYSTEM], "mongodb")
self.assertEqual(
span.attributes[SpanAttributes.DB_NAME], "database_name"
Expand Down Expand Up @@ -189,8 +188,7 @@ def test_int_command(self):

self.assertEqual(len(spans_list), 1)
span = spans_list[0]

self.assertEqual(span.name, "command_name.123")
self.assertEqual(span.name, "database_name.command_name")


class MockCommand:
Expand Down
7 changes: 0 additions & 7 deletions opentelemetry-distro/MANIFEST.in

This file was deleted.

56 changes: 56 additions & 0 deletions opentelemetry-distro/pyproject.toml
@@ -0,0 +1,56 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "opentelemetry-distro"
dynamic = ["version"]
description = "OpenTelemetry Python Distro"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.7"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Typing :: Typed",
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.33b0",
"opentelemetry-sdk == 1.12.0",
]

[project.optional-dependencies]
otlp = [
"opentelemetry-exporter-otlp == 1.12.0",
]
test = []

[project.entry-points.opentelemetry_configurator]
configurator = "opentelemetry.distro:OpenTelemetryConfigurator"

[project.entry-points.opentelemetry_distro]
distro = "opentelemetry.distro:OpenTelemetryDistro"

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-distro"

[tool.hatch.version]
path = "src/opentelemetry/distro/version.py"

[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests",
]

[tool.hatch.build.targets.wheel]
packages = ["src/opentelemetry"]
59 changes: 0 additions & 59 deletions opentelemetry-distro/setup.cfg

This file was deleted.

27 changes: 0 additions & 27 deletions opentelemetry-distro/setup.py

This file was deleted.

8 changes: 0 additions & 8 deletions opentelemetry-instrumentation/MANIFEST.in

This file was deleted.

55 changes: 55 additions & 0 deletions opentelemetry-instrumentation/pyproject.toml
@@ -0,0 +1,55 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "opentelemetry-instrumentation"
dynamic = ["version"]
description = "Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.7"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
dependencies = [
"opentelemetry-api ~= 1.4",
"setuptools >= 16.0",
"wrapt >= 1.0.0, < 2.0.0",
]

[project.optional-dependencies]
test = []

[project.scripts]
opentelemetry-bootstrap = "opentelemetry.instrumentation.bootstrap:run"
opentelemetry-instrument = "opentelemetry.instrumentation.auto_instrumentation:run"

[project.entry-points.opentelemetry_environment_variables]
instrumentation = "opentelemetry.instrumentation.environment_variables"

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation"

[tool.hatch.version]
path = "src/opentelemetry/instrumentation/version.py"

[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests",
]

[tool.hatch.build.targets.wheel]
packages = ["src/opentelemetry"]
59 changes: 0 additions & 59 deletions opentelemetry-instrumentation/setup.cfg

This file was deleted.

29 changes: 0 additions & 29 deletions opentelemetry-instrumentation/setup.py

This file was deleted.

0 comments on commit b91d370

Please sign in to comment.