Repository: open-telemetry/opentelemetry-python

Issue:
Update baggage header name
As per the spec, baggage propagation must use the header as specified in the w3c baggage specification https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/baggage/api.md#baggage-propagation


Discussion:

Resolving patch:
diff --git a/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py b/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py
--- a/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py
+++ b/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py
@@ -25,7 +25,7 @@ class BaggagePropagator(textmap.TextMapPropagator):
     MAX_HEADER_LENGTH = 8192
     MAX_PAIR_LENGTH = 4096
     MAX_PAIRS = 180
-    _BAGGAGE_HEADER_NAME = "otcorrelations"
+    _BAGGAGE_HEADER_NAME = "baggage"
 
     def extract(
         self,
@@ -85,9 +85,7 @@ def inject(
             return
 
         baggage_string = _format_baggage(baggage_entries)
-        set_in_carrier(
-            carrier, self._BAGGAGE_HEADER_NAME, baggage_string,
-        )
+        set_in_carrier(carrier, self._BAGGAGE_HEADER_NAME, baggage_string)
 
 
 def _format_baggage(baggage_entries: typing.Mapping[str, object]) -> str:


Test patch:
diff --git a/opentelemetry-api/tests/baggage/test_baggage_propagation.py b/opentelemetry-api/tests/baggage/test_baggage_propagation.py
--- a/opentelemetry-api/tests/baggage/test_baggage_propagation.py
+++ b/opentelemetry-api/tests/baggage/test_baggage_propagation.py
@@ -32,7 +32,7 @@ def setUp(self):
 
     def _extract(self, header_value):
         """Test helper"""
-        header = {"otcorrelations": [header_value]}
+        header = {"baggage": [header_value]}
         return baggage.get_all(self.propagator.extract(get_as_list, header))
 
     def _inject(self, values):
@@ -42,7 +42,7 @@ def _inject(self, values):
             ctx = baggage.set_baggage(k, v, context=ctx)
         output = {}
         self.propagator.inject(dict.__setitem__, output, context=ctx)
-        return output.get("otcorrelations")
+        return output.get("baggage")
 
     def test_no_context_header(self):
         baggage_entries = baggage.get_all(
diff --git a/opentelemetry-api/tests/propagators/test_global_httptextformat.py b/opentelemetry-api/tests/propagators/test_global_httptextformat.py
--- a/opentelemetry-api/tests/propagators/test_global_httptextformat.py
+++ b/opentelemetry-api/tests/propagators/test_global_httptextformat.py
@@ -28,8 +28,7 @@ def get_as_list(
 
 
 class TestDefaultGlobalPropagator(unittest.TestCase):
-    """Test ensures the default global composite propagator works as intended
-    """
+    """Test ensures the default global composite propagator works as intended"""
 
     TRACE_ID = int("12345678901234567890123456789012", 16)  # type:int
     SPAN_ID = int("1234567890123456", 16)  # type:int
@@ -41,7 +40,7 @@ def test_propagation(self):
         )
         tracestate_value = "foo=1,bar=2,baz=3"
         headers = {
-            "otcorrelations": ["key1=val1,key2=val2"],
+            "baggage": ["key1=val1,key2=val2"],
             "traceparent": [traceparent_value],
             "tracestate": [tracestate_value],
         }
@@ -61,8 +60,8 @@ def test_propagation(self):
         output = {}
         inject(dict.__setitem__, output, context=ctx)
         self.assertEqual(traceparent_value, output["traceparent"])
-        self.assertIn("key3=val3", output["otcorrelations"])
-        self.assertIn("key4=val4", output["otcorrelations"])
+        self.assertIn("key3=val3", output["baggage"])
+        self.assertIn("key4=val4", output["baggage"])
         self.assertIn("foo=1", output["tracestate"])
         self.assertIn("bar=2", output["tracestate"])
         self.assertIn("baz=3", output["tracestate"])