Skip to content

Commit b5c2d40

Browse files
owaisocelotl
authored andcommitted
Generate instrumentation packages setup.py files (open-telemetry#474)
All instrumentations packages have almost exactly same setup.py files. This commit adds a python script that generates it from a source template. This dramatically reduces the time and effort required to update all instrumentation setup.py files, and also reduces chances of making manual mistakes.
1 parent cb35cc4 commit b5c2d40

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
([#472](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/472))
1313
- Set the `traced_request_attrs` of FalconInstrumentor by an argument correctly.
1414
([#473](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/473))
15+
- `opentelemetry-propagator-ot-trace` Fix case sensitivity when handling baggage
16+
([#484](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/484))
1517

1618
### Added
1719
- Move `opentelemetry-instrumentation` from core repository

propagator/opentelemetry-propagator-ot-trace/src/opentelemetry/propagators/ot_trace/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def extract(
9595

9696
for key in getter.keys(carrier):
9797

98-
if not key.startswith(OT_BAGGAGE_PREFIX):
98+
if not key.lower().startswith(OT_BAGGAGE_PREFIX.lower()):
9999
continue
100100

101101
baggage[

propagator/opentelemetry-propagator-ot-trace/tests/test_ot_trace_propagator.py

+31
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,37 @@ def test_extract_baggage(self):
359359
self.assertEqual(baggage["abc"], "abc")
360360
self.assertEqual(baggage["def"], "def")
361361

362+
context = self.ot_trace_propagator.extract(
363+
{
364+
OT_TRACE_ID_HEADER: "64fe8b2a57d3eff7",
365+
OT_SPAN_ID_HEADER: "e457b5a2e4d86bd1",
366+
OT_SAMPLED_HEADER: "false",
367+
"".join(
368+
[
369+
"".join(
370+
[
371+
OT_BAGGAGE_PREFIX[:3].lower(),
372+
OT_BAGGAGE_PREFIX[3:].upper()
373+
]
374+
),
375+
"abc"
376+
]
377+
): "abc",
378+
"".join([OT_BAGGAGE_PREFIX, "def"]): "def",
379+
},
380+
)
381+
span_context = get_current_span(context).get_span_context()
382+
383+
self.assertEqual(hex(span_context.trace_id)[2:], "64fe8b2a57d3eff7")
384+
self.assertEqual(hex(span_context.span_id)[2:], "e457b5a2e4d86bd1")
385+
self.assertTrue(span_context.is_remote)
386+
self.assertEqual(span_context.trace_flags, TraceFlags.DEFAULT)
387+
388+
baggage = get_all(context)
389+
390+
self.assertEqual(baggage["abc"], "abc")
391+
self.assertEqual(baggage["def"], "def")
392+
362393
def test_extract_empty(self):
363394
"Test extraction when no headers are present"
364395

0 commit comments

Comments
 (0)