Skip to content

Commit 3ef7ec2

Browse files
author
alrex
authored
Merge branch 'master' into falcon-instrumentation
2 parents 0c6bd4b + e45354c commit 3ef7ec2

File tree

26 files changed

+259
-207
lines changed

26 files changed

+259
-207
lines changed

docs/api/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ OpenTelemetry Python API
66
.. toctree::
77
:maxdepth: 1
88

9+
baggage
910
configuration
1011
context
11-
correlationcontext
1212
metrics
1313
trace

docs/api/baggage.propagation.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
opentelemetry.baggage.propagation package
2+
====================================================
3+
4+
Module contents
5+
---------------
6+
7+
.. automodule:: opentelemetry.baggage.propagation

docs/api/baggage.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
opentelemetry.baggage package
2+
========================================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
9+
baggage.propagation
10+
11+
Module contents
12+
---------------
13+
14+
.. automodule:: opentelemetry.baggage

docs/api/correlationcontext.propagation.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/api/correlationcontext.rst

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Now run the above script, hit the root url (http://localhost:5000/) a few times,
174174
python flask_example.py
175175
176176
177-
Configure Your HTTP Propagator (b3, CorrelationContext)
177+
Configure Your HTTP Propagator (b3, Baggage)
178178
-------------------------------------------------------
179179

180180
A major feature of distributed tracing is the ability to correlate a trace across

docs/getting_started/tests/test_flask.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
from time import sleep
1919

2020
import requests
21+
from requests.adapters import HTTPAdapter
22+
from requests.packages.urllib3.util.retry import Retry
2123

2224

2325
class TestFlask(unittest.TestCase):
@@ -27,10 +29,13 @@ def test_flask(self):
2729
server = subprocess.Popen(
2830
[sys.executable, server_script], stdout=subprocess.PIPE,
2931
)
30-
sleep(1)
32+
retry_strategy = Retry(total=10, backoff_factor=1)
33+
adapter = HTTPAdapter(max_retries=retry_strategy)
34+
http = requests.Session()
35+
http.mount("http://", adapter)
3136

3237
try:
33-
result = requests.get("http://localhost:5000")
38+
result = http.get("http://localhost:5000")
3439
self.assertEqual(result.status_code, 200)
3540

3641
sleep(0.1)

instrumentation/opentelemetry-instrumentation-dbapi/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
- bugfix: cursors and connections now produce spans when used with context managers
6+
([#1028](https://github.com/open-telemetry/opentelemetry-python/pull/1028))
7+
58
## Version 0.12b0
69

710
Released 2020-08-14
@@ -19,4 +22,4 @@ Released 2020-05-12
1922

2023
Released 2020-02-21
2124

22-
- Initial release
25+
- Initial release

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,13 @@ def cursor(self, *args, **kwargs):
294294
self.__wrapped__.cursor(*args, **kwargs), db_api_integration
295295
)
296296

297+
def __enter__(self):
298+
self.__wrapped__.__enter__()
299+
return self
300+
301+
def __exit__(self, *args, **kwargs):
302+
self.__wrapped__.__exit__(*args, **kwargs)
303+
297304
return TracedConnectionProxy(connection, *args, **kwargs)
298305

299306

@@ -366,4 +373,11 @@ def callproc(self, *args, **kwargs):
366373
self.__wrapped__.callproc, *args, **kwargs
367374
)
368375

376+
def __enter__(self):
377+
self.__wrapped__.__enter__()
378+
return self
379+
380+
def __exit__(self, *args, **kwargs):
381+
self.__wrapped__.__exit__(*args, **kwargs)
382+
369383
return TracedCursorProxy(cursor, *args, **kwargs)

instrumentation/opentelemetry-instrumentation-opentracing-shim/src/opentelemetry/instrumentation/opentracing_shim/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
)
101101

102102
from opentelemetry import propagators
103+
from opentelemetry.baggage import get_baggage, set_baggage
103104
from opentelemetry.context import Context, attach, detach, get_value, set_value
104-
from opentelemetry.correlationcontext import get_correlation, set_correlation
105105
from opentelemetry.instrumentation.opentracing_shim import util
106106
from opentelemetry.instrumentation.opentracing_shim.version import __version__
107107
from opentelemetry.trace import INVALID_SPAN_CONTEXT, DefaultSpan, Link
@@ -290,7 +290,7 @@ def set_baggage_item(self, key: str, value: str):
290290
value: A tag value.
291291
"""
292292
# pylint: disable=protected-access
293-
self._context._baggage = set_correlation(
293+
self._context._baggage = set_baggage(
294294
key, value, context=self._context._baggage
295295
)
296296

@@ -303,7 +303,7 @@ def get_baggage_item(self, key: str) -> Optional[object]:
303303
Returns this :class:`SpanShim` instance to allow call chaining.
304304
"""
305305
# pylint: disable=protected-access
306-
return get_correlation(key, context=self._context._baggage)
306+
return get_baggage(key, context=self._context._baggage)
307307

308308

309309
class ScopeShim(Scope):

0 commit comments

Comments
 (0)