Skip to content

Correlation context docs #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ OpenTelemetry Python API

configuration
context
correlationcontext
metrics
trace
7 changes: 7 additions & 0 deletions docs/api/correlationcontext.propagation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opentelemetry.correlationcontext.propagation package
====================================================

Module contents
---------------

.. automodule:: opentelemetry.correlationcontext.propagation
14 changes: 14 additions & 0 deletions docs/api/correlationcontext.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
opentelemetry.correlationcontext package
========================================

Subpackages
-----------

.. toctree::

correlationcontext.propagation

Module contents
---------------

.. automodule:: opentelemetry.correlationcontext
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down