opentelemetry-instrumentation-aiohttp-client 0.43b0__tar.gz → 0.45b0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: opentelemetry-instrumentation-aiohttp-client
3
- Version: 0.43b0
3
+ Version: 0.45b0
4
4
  Summary: OpenTelemetry aiohttp client instrumentation
5
5
  Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aiohttp-client
6
6
  Author-email: OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>
@@ -11,22 +11,18 @@ Classifier: Intended Audience :: Developers
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Programming Language :: Python
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.7
15
14
  Classifier: Programming Language :: Python :: 3.8
16
15
  Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
- Requires-Python: >=3.7
18
+ Requires-Python: >=3.8
20
19
  Requires-Dist: opentelemetry-api~=1.12
21
- Requires-Dist: opentelemetry-instrumentation==0.43b0
22
- Requires-Dist: opentelemetry-semantic-conventions==0.43b0
23
- Requires-Dist: opentelemetry-util-http==0.43b0
20
+ Requires-Dist: opentelemetry-instrumentation==0.45b0
21
+ Requires-Dist: opentelemetry-semantic-conventions==0.45b0
22
+ Requires-Dist: opentelemetry-util-http==0.45b0
24
23
  Requires-Dist: wrapt<2.0.0,>=1.0.0
25
24
  Provides-Extra: instruments
26
25
  Requires-Dist: aiohttp~=3.0; extra == 'instruments'
27
- Provides-Extra: test
28
- Requires-Dist: http-server-mock; extra == 'test'
29
- Requires-Dist: opentelemetry-instrumentation-aiohttp-client[instruments]; extra == 'test'
30
26
  Description-Content-Type: text/x-rst
31
27
 
32
28
  OpenTelemetry aiohttp client Integration
@@ -8,7 +8,7 @@ dynamic = ["version"]
8
8
  description = "OpenTelemetry aiohttp client instrumentation"
9
9
  readme = "README.rst"
10
10
  license = "Apache-2.0"
11
- requires-python = ">=3.7"
11
+ requires-python = ">=3.8"
12
12
  authors = [
13
13
  { name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
14
14
  ]
@@ -18,7 +18,6 @@ classifiers = [
18
18
  "License :: OSI Approved :: Apache Software License",
19
19
  "Programming Language :: Python",
20
20
  "Programming Language :: Python :: 3",
21
- "Programming Language :: Python :: 3.7",
22
21
  "Programming Language :: Python :: 3.8",
23
22
  "Programming Language :: Python :: 3.9",
24
23
  "Programming Language :: Python :: 3.10",
@@ -26,9 +25,9 @@ classifiers = [
26
25
  ]
27
26
  dependencies = [
28
27
  "opentelemetry-api ~= 1.12",
29
- "opentelemetry-instrumentation == 0.43b0",
30
- "opentelemetry-semantic-conventions == 0.43b0",
31
- "opentelemetry-util-http == 0.43b0",
28
+ "opentelemetry-instrumentation == 0.45b0",
29
+ "opentelemetry-semantic-conventions == 0.45b0",
30
+ "opentelemetry-util-http == 0.45b0",
32
31
  "wrapt >= 1.0.0, < 2.0.0",
33
32
  ]
34
33
 
@@ -36,10 +35,6 @@ dependencies = [
36
35
  instruments = [
37
36
  "aiohttp ~= 3.0",
38
37
  ]
39
- test = [
40
- "opentelemetry-instrumentation-aiohttp-client[instruments]",
41
- "http-server-mock"
42
- ]
43
38
 
44
39
  [project.entry-points.opentelemetry_instrumentor]
45
40
  aiohttp-client = "opentelemetry.instrumentation.aiohttp_client:AioHttpClientInstrumentor"
@@ -94,8 +94,8 @@ from opentelemetry.instrumentation.aiohttp_client.package import _instruments
94
94
  from opentelemetry.instrumentation.aiohttp_client.version import __version__
95
95
  from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
96
96
  from opentelemetry.instrumentation.utils import (
97
- _SUPPRESS_INSTRUMENTATION_KEY,
98
97
  http_status_to_status_code,
98
+ is_instrumentation_enabled,
99
99
  unwrap,
100
100
  )
101
101
  from opentelemetry.propagate import inject
@@ -179,7 +179,7 @@ def create_trace_config(
179
179
  trace_config_ctx: types.SimpleNamespace,
180
180
  params: aiohttp.TraceRequestStartParams,
181
181
  ):
182
- if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
182
+ if not is_instrumentation_enabled():
183
183
  trace_config_ctx.span = None
184
184
  return
185
185
 
@@ -282,7 +282,7 @@ def _instrument(
282
282
 
283
283
  # pylint:disable=unused-argument
284
284
  def instrumented_init(wrapped, instance, args, kwargs):
285
- if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
285
+ if not is_instrumentation_enabled():
286
286
  return wrapped(*args, **kwargs)
287
287
 
288
288
  client_trace_configs = list(kwargs.get("trace_configs") or [])
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.43b0"
15
+ __version__ = "0.45b0"
@@ -27,13 +27,12 @@ import yarl
27
27
  from http_server_mock import HttpServerMock
28
28
  from pkg_resources import iter_entry_points
29
29
 
30
- from opentelemetry import context
31
30
  from opentelemetry import trace as trace_api
32
31
  from opentelemetry.instrumentation import aiohttp_client
33
32
  from opentelemetry.instrumentation.aiohttp_client import (
34
33
  AioHttpClientInstrumentor,
35
34
  )
36
- from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
35
+ from opentelemetry.instrumentation.utils import suppress_instrumentation
37
36
  from opentelemetry.semconv.trace import SpanAttributes
38
37
  from opentelemetry.test.test_base import TestBase
39
38
  from opentelemetry.trace import Span, StatusCode
@@ -512,25 +511,17 @@ class TestAioHttpClientInstrumentor(TestBase):
512
511
  self.assert_spans(1)
513
512
 
514
513
  def test_suppress_instrumentation(self):
515
- token = context.attach(
516
- context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
517
- )
518
- try:
514
+ with suppress_instrumentation():
519
515
  run_with_test_server(
520
516
  self.get_default_request(), self.URL, self.default_handler
521
517
  )
522
- finally:
523
- context.detach(token)
524
518
  self.assert_spans(0)
525
519
 
526
520
  @staticmethod
527
521
  async def suppressed_request(server: aiohttp.test_utils.TestServer):
528
522
  async with aiohttp.test_utils.TestClient(server) as client:
529
- token = context.attach(
530
- context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
531
- )
532
- await client.get(TestAioHttpClientInstrumentor.URL)
533
- context.detach(token)
523
+ with suppress_instrumentation():
524
+ await client.get(TestAioHttpClientInstrumentor.URL)
534
525
 
535
526
  def test_suppress_instrumentation_after_creation(self):
536
527
  run_with_test_server(