forked from open-telemetry/opentelemetry-python-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into custom-sw-build
- Loading branch information
Showing
33 changed files
with
605 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
-c dev-requirements.txt | ||
astor==0.8.1 | ||
jinja2==3.1.3 | ||
jinja2==3.1.4 | ||
markupsafe==2.0.1 | ||
isort | ||
black | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...mentation/opentelemetry-instrumentation-asyncio/tests/test_asyncio_future_cancellation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import asyncio | ||
from unittest.mock import patch | ||
|
||
from opentelemetry.instrumentation.asyncio import AsyncioInstrumentor | ||
from opentelemetry.instrumentation.asyncio.environment_variables import ( | ||
OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED, | ||
) | ||
from opentelemetry.test.test_base import TestBase | ||
from opentelemetry.trace import get_tracer | ||
|
||
|
||
class TestTraceFuture(TestBase): | ||
@patch.dict( | ||
"os.environ", {OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED: "true"} | ||
) | ||
def setUp(self): | ||
super().setUp() | ||
self._tracer = get_tracer( | ||
__name__, | ||
) | ||
self.instrumentor = AsyncioInstrumentor() | ||
self.instrumentor.instrument() | ||
|
||
def tearDown(self): | ||
super().tearDown() | ||
self.instrumentor.uninstrument() | ||
|
||
def test_trace_future_cancelled(self): | ||
async def future_cancelled(): | ||
with self._tracer.start_as_current_span("root"): | ||
future = asyncio.Future() | ||
future = self.instrumentor.trace_future(future) | ||
future.cancel() | ||
|
||
try: | ||
asyncio.run(future_cancelled()) | ||
except asyncio.CancelledError as exc: | ||
self.assertEqual(isinstance(exc, asyncio.CancelledError), True) | ||
spans = self.memory_exporter.get_finished_spans() | ||
self.assertEqual(len(spans), 2) | ||
self.assertEqual(spans[0].name, "root") | ||
self.assertEqual(spans[1].name, "asyncio future") | ||
|
||
metrics = ( | ||
self.memory_metrics_reader.get_metrics_data() | ||
.resource_metrics[0] | ||
.scope_metrics[0] | ||
.metrics | ||
) | ||
self.assertEqual(len(metrics), 2) | ||
|
||
self.assertEqual(metrics[0].name, "asyncio.process.duration") | ||
self.assertEqual( | ||
metrics[0].data.data_points[0].attributes["state"], "cancelled" | ||
) | ||
|
||
self.assertEqual(metrics[1].name, "asyncio.process.created") | ||
self.assertEqual( | ||
metrics[1].data.data_points[0].attributes["state"], "cancelled" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
asgiref==3.7.2 | ||
attrs==23.2.0 | ||
Deprecated==1.2.14 | ||
elasticsearch==8.12.1 | ||
elasticsearch-dsl==8.12.0 | ||
elastic-transport==8.12.0 | ||
importlib-metadata==6.11.0 | ||
iniconfig==2.0.0 | ||
packaging==23.2 | ||
pluggy==1.4.0 | ||
py==1.11.0 | ||
py-cpuinfo==9.0.0 | ||
pytest==7.1.3 | ||
pytest-benchmark==4.0.0 | ||
python-dateutil==2.8.2 | ||
six==1.16.0 | ||
tomli==2.0.1 | ||
typing_extensions==4.10.0 | ||
urllib3==2.2.1 | ||
wrapt==1.16.0 | ||
zipp==3.17.0 | ||
-e opentelemetry-instrumentation | ||
-e instrumentation/opentelemetry-instrumentation-elasticsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.