diff --git a/docs/api/api.rst b/docs/api/api.rst index 8af950652f2..e1e82114296 100644 --- a/docs/api/api.rst +++ b/docs/api/api.rst @@ -8,5 +8,6 @@ OpenTelemetry Python API configuration context + correlationcontext metrics trace diff --git a/docs/api/correlationcontext.propagation.rst b/docs/api/correlationcontext.propagation.rst new file mode 100644 index 00000000000..a9b94aa4fb4 --- /dev/null +++ b/docs/api/correlationcontext.propagation.rst @@ -0,0 +1,7 @@ +opentelemetry.correlationcontext.propagation package +==================================================== + +Module contents +--------------- + +.. automodule:: opentelemetry.correlationcontext.propagation diff --git a/docs/api/correlationcontext.rst b/docs/api/correlationcontext.rst new file mode 100644 index 00000000000..10e7b2e573b --- /dev/null +++ b/docs/api/correlationcontext.rst @@ -0,0 +1,14 @@ +opentelemetry.correlationcontext package +======================================== + +Subpackages +----------- + +.. toctree:: + + correlationcontext.propagation + +Module contents +--------------- + +.. automodule:: opentelemetry.correlationcontext diff --git a/opentelemetry-api/src/opentelemetry/correlationcontext/__init__.py b/opentelemetry-api/src/opentelemetry/correlationcontext/__init__.py index b0b3624d720..543c175dfe1 100644 --- a/opentelemetry-api/src/opentelemetry/correlationcontext/__init__.py +++ b/opentelemetry-api/src/opentelemetry/correlationcontext/__init__.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import abc import typing from opentelemetry.context import get_value, set_value @@ -24,7 +23,7 @@ def get_correlations( context: typing.Optional[Context] = None, ) -> typing.Dict[str, object]: - """ Returns the name/value pairs in the CorrelationContext + """Returns the name/value pairs in the CorrelationContext Args: context: The Context to use. If not set, uses current Context @@ -41,7 +40,8 @@ def get_correlations( def get_correlation( name: str, context: typing.Optional[Context] = None ) -> typing.Optional[object]: - """ Provides access to the value for a name/value pair in the CorrelationContext + """Provides access to the value for a name/value pair in the + CorrelationContext Args: name: The name of the value to retrieve @@ -76,6 +76,7 @@ def remove_correlation( name: str, context: typing.Optional[Context] = None ) -> Context: """Removes a value from the CorrelationContext + Args: name: The name of the value to remove context: The Context to use. If not set, uses current Context @@ -91,6 +92,7 @@ def remove_correlation( def clear_correlations(context: typing.Optional[Context] = None) -> Context: """Removes all values from the CorrelationContext + Args: context: The Context to use. If not set, uses current Context diff --git a/opentelemetry-api/src/opentelemetry/correlationcontext/propagation/__init__.py b/opentelemetry-api/src/opentelemetry/correlationcontext/propagation/__init__.py index 72ad80de1a9..c336f4476b6 100644 --- a/opentelemetry-api/src/opentelemetry/correlationcontext/propagation/__init__.py +++ b/opentelemetry-api/src/opentelemetry/correlationcontext/propagation/__init__.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import re import typing import urllib.parse @@ -36,9 +35,10 @@ def extract( carrier: httptextformat.HTTPTextFormatT, context: typing.Optional[Context] = None, ) -> Context: - """ Extract CorrelationContext from the carrier. + """Extract CorrelationContext from the carrier. - See `opentelemetry.trace.propagation.httptextformat.HTTPTextFormat.extract` + See + `opentelemetry.trace.propagation.httptextformat.HTTPTextFormat.extract` """ if context is None: @@ -79,7 +79,8 @@ def inject( ) -> None: """Injects CorrelationContext into the carrier. - See `opentelemetry.trace.propagation.httptextformat.HTTPTextFormat.inject` + See + `opentelemetry.trace.propagation.httptextformat.HTTPTextFormat.inject` """ correlations = correlationcontext.get_correlations(context=context) if not correlations: