Repository: open-telemetry/opentelemetry-python

Issue:
Rename CompositeHTTPPropagator
[`CompositeHTTPPropagator`](https://github.com/open-telemetry/opentelemetry-python/blob/b73d8009904fc1693b2ba3a1e0656af376f859cf/opentelemetry-api/src/opentelemetry/propagators/composite.py#L23) has nothing to do with HTTP so this name is confusing. It should be renamed to probably just `CompositePropagator`, but we need to keep an alias of the old name for backward compatibility.

[Relevant section of spec](https://github.com/open-telemetry/opentelemetry-python/blob/b73d8009904fc1693b2ba3a1e0656af376f859cf/opentelemetry-api/src/opentelemetry/propagators/composite.py#L23)




Discussion:
UGH HOW DID WE MISS THIS?

Resolving patch:
diff --git a/docs/examples/datadog_exporter/server.py b/docs/examples/datadog_exporter/server.py
--- a/docs/examples/datadog_exporter/server.py
+++ b/docs/examples/datadog_exporter/server.py
@@ -21,7 +21,7 @@
 )
 from opentelemetry.exporter.datadog.propagator import DatadogFormat
 from opentelemetry.propagate import get_global_textmap, set_global_textmap
-from opentelemetry.propagators.composite import CompositeHTTPPropagator
+from opentelemetry.propagators.composite import CompositePropagator
 from opentelemetry.sdk.trace import TracerProvider
 
 app = Flask(__name__)
@@ -38,13 +38,11 @@
 
 # append Datadog format for propagation to and from Datadog instrumented services
 global_textmap = get_global_textmap()
-if isinstance(global_textmap, CompositeHTTPPropagator) and not any(
+if isinstance(global_textmap, CompositePropagator) and not any(
     isinstance(p, DatadogFormat) for p in global_textmap._propagators
 ):
     set_global_textmap(
-        CompositeHTTPPropagator(
-            global_textmap._propagators + [DatadogFormat()]
-        )
+        CompositePropagator(global_textmap._propagators + [DatadogFormat()])
     )
 else:
     set_global_textmap(DatadogFormat())
diff --git a/opentelemetry-api/src/opentelemetry/propagate/__init__.py b/opentelemetry-api/src/opentelemetry/propagate/__init__.py
--- a/opentelemetry-api/src/opentelemetry/propagate/__init__.py
+++ b/opentelemetry-api/src/opentelemetry/propagate/__init__.py
@@ -16,13 +16,13 @@
 API for propagation of context.
 
 The propagators for the
-``opentelemetry.propagators.composite.CompositeHTTPPropagator`` can be defined
+``opentelemetry.propagators.composite.CompositePropagator`` can be defined
 via configuration in the ``OTEL_PROPAGATORS`` environment variable. This
 variable should be set to a comma-separated string of names of values for the
 ``opentelemetry_propagator`` entry point. For example, setting
 ``OTEL_PROPAGATORS`` to ``tracecontext,baggage`` (which is the default value)
 would instantiate
-``opentelemetry.propagators.composite.CompositeHTTPPropagator`` with 2
+``opentelemetry.propagators.composite.CompositePropagator`` with 2
 propagators, one of type
 ``opentelemetry.trace.propagation.tracecontext.TraceContextTextMapPropagator``
 and other of type ``opentelemetry.baggage.propagation.W3CBaggagePropagator``.
@@ -142,7 +142,7 @@ def inject(
     logger.exception("Failed to load configured propagators")
     raise
 
-_HTTP_TEXT_FORMAT = composite.CompositeHTTPPropagator(propagators)  # type: ignore
+_HTTP_TEXT_FORMAT = composite.CompositePropagator(propagators)  # type: ignore
 
 
 def get_global_textmap() -> textmap.TextMapPropagator:
diff --git a/opentelemetry-api/src/opentelemetry/propagators/composite.py b/opentelemetry-api/src/opentelemetry/propagators/composite.py
--- a/opentelemetry-api/src/opentelemetry/propagators/composite.py
+++ b/opentelemetry-api/src/opentelemetry/propagators/composite.py
@@ -14,14 +14,16 @@
 import logging
 import typing
 
+from deprecated import deprecated
+
 from opentelemetry.context.context import Context
 from opentelemetry.propagators import textmap
 
 logger = logging.getLogger(__name__)
 
 
-class CompositeHTTPPropagator(textmap.TextMapPropagator):
-    """CompositeHTTPPropagator provides a mechanism for combining multiple
+class CompositePropagator(textmap.TextMapPropagator):
+    """CompositePropagator provides a mechanism for combining multiple
     propagators into a single one.
 
     Args:
@@ -80,3 +82,10 @@ def fields(self) -> typing.Set[str]:
                 composite_fields.add(field)
 
         return composite_fields
+
+
+@deprecated(version="1.2.0", reason="You should use CompositePropagator")  # type: ignore
+class CompositeHTTPPropagator(CompositePropagator):
+    """CompositeHTTPPropagator provides a mechanism for combining multiple
+    propagators into a single one.
+    """


Test patch:
diff --git a/opentelemetry-api/tests/propagators/test_composite.py b/opentelemetry-api/tests/propagators/test_composite.py
--- a/opentelemetry-api/tests/propagators/test_composite.py
+++ b/opentelemetry-api/tests/propagators/test_composite.py
@@ -17,7 +17,7 @@
 import unittest
 from unittest.mock import Mock
 
-from opentelemetry.propagators.composite import CompositeHTTPPropagator
+from opentelemetry.propagators.composite import CompositePropagator
 
 
 def get_as_list(dict_object, key):
@@ -67,7 +67,7 @@ def setUpClass(cls):
         )
 
     def test_no_propagators(self):
-        propagator = CompositeHTTPPropagator([])
+        propagator = CompositePropagator([])
         new_carrier = {}
         propagator.inject(new_carrier)
         self.assertEqual(new_carrier, {})
@@ -78,7 +78,7 @@ def test_no_propagators(self):
         self.assertEqual(context, {})
 
     def test_single_propagator(self):
-        propagator = CompositeHTTPPropagator([self.mock_propagator_0])
+        propagator = CompositePropagator([self.mock_propagator_0])
 
         new_carrier = {}
         propagator.inject(new_carrier)
@@ -90,7 +90,7 @@ def test_single_propagator(self):
         self.assertEqual(context, {"mock-0": "context"})
 
     def test_multiple_propagators(self):
-        propagator = CompositeHTTPPropagator(
+        propagator = CompositePropagator(
             [self.mock_propagator_0, self.mock_propagator_1]
         )
 
@@ -106,7 +106,7 @@ def test_multiple_propagators(self):
     def test_multiple_propagators_same_key(self):
         # test that when multiple propagators extract/inject the same
         # key, the later propagator values are extracted/injected
-        propagator = CompositeHTTPPropagator(
+        propagator = CompositePropagator(
             [self.mock_propagator_0, self.mock_propagator_2]
         )
 
@@ -120,7 +120,7 @@ def test_multiple_propagators_same_key(self):
         self.assertEqual(context, {"mock-0": "context2"})
 
     def test_fields(self):
-        propagator = CompositeHTTPPropagator(
+        propagator = CompositePropagator(
             [
                 self.mock_propagator_0,
                 self.mock_propagator_1,
diff --git a/opentelemetry-api/tests/propagators/test_propagators.py b/opentelemetry-api/tests/propagators/test_propagators.py
--- a/opentelemetry-api/tests/propagators/test_propagators.py
+++ b/opentelemetry-api/tests/propagators/test_propagators.py
@@ -27,7 +27,7 @@
 
 
 class TestPropagators(TestCase):
-    @patch("opentelemetry.propagators.composite.CompositeHTTPPropagator")
+    @patch("opentelemetry.propagators.composite.CompositePropagator")
     def test_default_composite_propagators(self, mock_compositehttppropagator):
         def test_propagators(propagators):
 
@@ -48,7 +48,7 @@ def test_propagators(propagators):
         reload(opentelemetry.propagate)
 
     @patch.dict(environ, {OTEL_PROPAGATORS: "a,b,c"})
-    @patch("opentelemetry.propagators.composite.CompositeHTTPPropagator")
+    @patch("opentelemetry.propagators.composite.CompositePropagator")
     @patch("pkg_resources.iter_entry_points")
     def test_non_default_propagators(
         self, mock_iter_entry_points, mock_compositehttppropagator