Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-opentelemetry-api for
openSUSE:Factory checked in at 2024-06-18 22:51:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-opentelemetry-api (Old)
and /work/SRC/openSUSE:Factory/.python-opentelemetry-api.new.19518 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-opentelemetry-api"
Tue Jun 18 22:51:06 2024 rev:14 rq:1181383 version:1.25.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-opentelemetry-api/python-opentelemetry-api.changes
2024-04-04 22:25:46.202231669 +0200
+++
/work/SRC/openSUSE:Factory/.python-opentelemetry-api.new.19518/python-opentelemetry-api.changes
2024-06-18 22:51:52.734823401 +0200
@@ -1,0 +2,26 @@
+Mon Jun 17 11:41:56 UTC 2024 - Dirk Müller <[email protected]>
+
+- update to 1.25.0:
+ * Fix class BoundedAttributes to have RLock rather than Lock
+ * Remove thread lock by loading RuntimeContext explicitly.
+ * Update proto version to v1.2.0
+ * Add to_json method to ExponentialHistogram
+ * Bump mypy to 1.9.0
+ * Fix exponential histograms
+ * Fix otlp exporter to export log_record.observed_timestamp
+ * Add capture the fully qualified type name for raised
+ exceptions in spans
+ * Prometheus exporter sort label keys to prevent duplicate
+ metrics when user input changes order
+ * Update semantic conventions to version 1.25.0.
+ * Rename test objects to avoid pytest warnings
+ * Add span flags to OTLP spans and links
+ * Record links with invalid SpanContext if either attributes or
+ TraceState are not empty
+ * Add OpenTelemetry trove classifiers to PyPI packages
+ * Fix prometheus metric name and unit conversion (#3924)
+ * Add parameters for Distros and configurators to configure
+ autoinstrumentation in addition to existing environment
+ variables.
+
+-------------------------------------------------------------------
Old:
----
opentelemetry_api-1.24.0.tar.gz
New:
----
opentelemetry_api-1.25.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-opentelemetry-api.spec ++++++
--- /var/tmp/diff_new_pack.koMnCV/_old 2024-06-18 22:51:53.178839771 +0200
+++ /var/tmp/diff_new_pack.koMnCV/_new 2024-06-18 22:51:53.178839771 +0200
@@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-opentelemetry-api
-Version: 1.24.0
+Version: 1.25.0
Release: 0
Summary: OpenTelemetry Python API
License: Apache-2.0
++++++ opentelemetry_api-1.24.0.tar.gz -> opentelemetry_api-1.25.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/opentelemetry_api-1.24.0/LICENSE
new/opentelemetry_api-1.25.0/LICENSE
--- old/opentelemetry_api-1.24.0/LICENSE 2020-02-02 01:00:00.000000000
+0100
+++ new/opentelemetry_api-1.25.0/LICENSE 2020-02-02 01:00:00.000000000
+0100
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright The OpenTelemetry Authors
+ Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/opentelemetry_api-1.24.0/PKG-INFO
new/opentelemetry_api-1.25.0/PKG-INFO
--- old/opentelemetry_api-1.24.0/PKG-INFO 2020-02-02 01:00:00.000000000
+0100
+++ new/opentelemetry_api-1.25.0/PKG-INFO 2020-02-02 01:00:00.000000000
+0100
@@ -1,12 +1,13 @@
Metadata-Version: 2.3
Name: opentelemetry-api
-Version: 1.24.0
+Version: 1.25.0
Summary: OpenTelemetry Python API
Project-URL: Homepage,
https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-api
Author-email: OpenTelemetry Authors
<[email protected]>
License: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
+Classifier: Framework :: OpenTelemetry
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
@@ -18,7 +19,7 @@
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: deprecated>=1.2.6
-Requires-Dist: importlib-metadata<=7.0,>=6.0
+Requires-Dist: importlib-metadata<=7.1,>=6.0
Description-Content-Type: text/x-rst
OpenTelemetry Python API
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/opentelemetry_api-1.24.0/pyproject.toml
new/opentelemetry_api-1.25.0/pyproject.toml
--- old/opentelemetry_api-1.24.0/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
+++ new/opentelemetry_api-1.25.0/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
@@ -13,6 +13,7 @@
]
classifiers = [
"Development Status :: 5 - Production/Stable",
+ "Framework :: OpenTelemetry",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
@@ -27,7 +28,7 @@
"Deprecated >= 1.2.6",
# FIXME This should be able to be removed after 3.12 is released if there
is a reliable API
# in importlib.metadata.
- "importlib-metadata >= 6.0, <= 7.0",
+ "importlib-metadata >= 6.0, <= 7.1",
]
dynamic = [
"version",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/_logs/_internal/__init__.py
new/opentelemetry_api-1.25.0/src/opentelemetry/_logs/_internal/__init__.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/_logs/_internal/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/_logs/_internal/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -193,7 +193,6 @@
schema_url: Optional[str] = None,
) -> Logger:
"""Returns a NoOpLogger."""
- super().get_logger(name, version=version, schema_url=schema_url)
return NoOpLogger(name, version=version, schema_url=schema_url)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/attributes/__init__.py
new/opentelemetry_api-1.25.0/src/opentelemetry/attributes/__init__.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/attributes/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/attributes/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -150,7 +150,7 @@
self.max_value_len = max_value_len
# OrderedDict is not used until the maxlen is reached for efficiency.
self._dict = {} # type: dict | OrderedDict
- self._lock = threading.Lock() # type: threading.Lock
+ self._lock = threading.RLock() # type: threading.RLock
if attributes:
for key, value in attributes.items():
self[key] = value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/baggage/propagation/__init__.py
new/opentelemetry_api-1.25.0/src/opentelemetry/baggage/propagation/__init__.py
---
old/opentelemetry_api-1.24.0/src/opentelemetry/baggage/propagation/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++
new/opentelemetry_api-1.25.0/src/opentelemetry/baggage/propagation/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -83,7 +83,7 @@
continue
try:
name, value = entry.split("=", 1)
- except Exception: # pylint: disable=broad-except
+ except Exception: # pylint: disable=broad-exception-caught
_logger.warning(
"Baggage list-member `%s` doesn't match the format", entry
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/context/__init__.py
new/opentelemetry_api-1.25.0/src/opentelemetry/context/__init__.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/context/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/context/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -13,9 +13,7 @@
# limitations under the License.
import logging
-import threading
import typing
-from functools import wraps
from os import environ
from uuid import uuid4
@@ -25,54 +23,50 @@
from opentelemetry.util._importlib_metadata import entry_points
logger = logging.getLogger(__name__)
-_RUNTIME_CONTEXT = None # type: typing.Optional[_RuntimeContext]
-_RUNTIME_CONTEXT_LOCK = threading.Lock()
-_F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any])
-
-def _load_runtime_context(func: _F) -> _F:
- """A decorator used to initialize the global RuntimeContext
+def _load_runtime_context() -> _RuntimeContext:
+ """Initialize the RuntimeContext
Returns:
- A wrapper of the decorated method.
- """
-
- @wraps(func) # type: ignore[misc]
- def wrapper(
- *args: typing.Tuple[typing.Any, typing.Any],
- **kwargs: typing.Dict[typing.Any, typing.Any],
- ) -> typing.Optional[typing.Any]:
- global _RUNTIME_CONTEXT # pylint: disable=global-statement
-
- with _RUNTIME_CONTEXT_LOCK:
- if _RUNTIME_CONTEXT is None:
- # FIXME use a better implementation of a configuration manager
- # to avoid having to get configuration values straight from
- # environment variables
- default_context = "contextvars_context"
-
- configured_context = environ.get(
- OTEL_PYTHON_CONTEXT, default_context
- ) # type: str
- try:
-
- _RUNTIME_CONTEXT = next( # type: ignore
- iter( # type: ignore
- entry_points( # type: ignore
- group="opentelemetry_context",
- name=configured_context,
- )
- )
- ).load()()
-
- except Exception: # pylint: disable=broad-except
- logger.exception(
- "Failed to load context: %s", configured_context
- )
- return func(*args, **kwargs) # type: ignore[misc]
+ An instance of RuntimeContext.
+ """
+
+ # FIXME use a better implementation of a configuration manager
+ # to avoid having to get configuration values straight from
+ # environment variables
+ default_context = "contextvars_context"
+
+ configured_context = environ.get(
+ OTEL_PYTHON_CONTEXT, default_context
+ ) # type: str
+
+ try:
+ return next( # type: ignore
+ iter( # type: ignore
+ entry_points( # type: ignore
+ group="opentelemetry_context",
+ name=configured_context,
+ )
+ )
+ ).load()()
+ except Exception: # pylint: disable=broad-exception-caught
+ logger.exception(
+ "Failed to load context: %s, fallback to %s",
+ configured_context,
+ default_context,
+ )
+ return next( # type: ignore
+ iter( # type: ignore
+ entry_points( # type: ignore
+ group="opentelemetry_context",
+ name=default_context,
+ )
+ )
+ ).load()()
+
- return typing.cast(_F, wrapper) # type: ignore[misc]
+_RUNTIME_CONTEXT = _load_runtime_context()
def create_key(keyname: str) -> str:
@@ -125,7 +119,6 @@
return Context(new_values)
-@_load_runtime_context # type: ignore
def get_current() -> Context:
"""To access the context associated with program execution,
the Context API provides a function which takes no arguments
@@ -134,10 +127,9 @@
Returns:
The current `Context` object.
"""
- return _RUNTIME_CONTEXT.get_current() # type:ignore
+ return _RUNTIME_CONTEXT.get_current()
-@_load_runtime_context # type: ignore
def attach(context: Context) -> object:
"""Associates a Context with the caller's current execution unit. Returns
a token that can be used to restore the previous Context.
@@ -148,10 +140,9 @@
Returns:
A token that can be used with `detach` to reset the context.
"""
- return _RUNTIME_CONTEXT.attach(context) # type:ignore
+ return _RUNTIME_CONTEXT.attach(context)
-@_load_runtime_context # type: ignore
def detach(token: object) -> None:
"""Resets the Context associated with the caller's current execution unit
to the value it had before attaching a specified Context.
@@ -160,8 +151,8 @@
token: The Token that was returned by a previous call to attach a
Context.
"""
try:
- _RUNTIME_CONTEXT.detach(token) # type: ignore
- except Exception: # pylint: disable=broad-except
+ _RUNTIME_CONTEXT.detach(token)
+ except Exception: # pylint: disable=broad-exception-caught
logger.exception("Failed to detach context")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/metrics/_internal/__init__.py
new/opentelemetry_api-1.25.0/src/opentelemetry/metrics/_internal/__init__.py
---
old/opentelemetry_api-1.24.0/src/opentelemetry/metrics/_internal/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++
new/opentelemetry_api-1.25.0/src/opentelemetry/metrics/_internal/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -141,7 +141,6 @@
schema_url: Optional[str] = None,
) -> "Meter":
"""Returns a NoOpMeter."""
- super().get_meter(name, version=version, schema_url=schema_url)
return NoOpMeter(name, version=version, schema_url=schema_url)
@@ -599,7 +598,6 @@
description: str = "",
) -> Counter:
"""Returns a no-op Counter."""
- super().create_counter(name, unit=unit, description=description)
if self._is_instrument_registered(
name, NoOpCounter, unit, description
)[0]:
@@ -620,7 +618,6 @@
description: str = "",
) -> Gauge:
"""Returns a no-op Gauge."""
- super().create_gauge(name, unit=unit, description=description)
if self._is_instrument_registered(name, NoOpGauge, unit, description)[
0
]:
@@ -641,9 +638,6 @@
description: str = "",
) -> UpDownCounter:
"""Returns a no-op UpDownCounter."""
- super().create_up_down_counter(
- name, unit=unit, description=description
- )
if self._is_instrument_registered(
name, NoOpUpDownCounter, unit, description
)[0]:
@@ -665,9 +659,6 @@
description: str = "",
) -> ObservableCounter:
"""Returns a no-op ObservableCounter."""
- super().create_observable_counter(
- name, callbacks, unit=unit, description=description
- )
if self._is_instrument_registered(
name, NoOpObservableCounter, unit, description
)[0]:
@@ -693,7 +684,6 @@
description: str = "",
) -> Histogram:
"""Returns a no-op Histogram."""
- super().create_histogram(name, unit=unit, description=description)
if self._is_instrument_registered(
name, NoOpHistogram, unit, description
)[0]:
@@ -715,9 +705,6 @@
description: str = "",
) -> ObservableGauge:
"""Returns a no-op ObservableGauge."""
- super().create_observable_gauge(
- name, callbacks, unit=unit, description=description
- )
if self._is_instrument_registered(
name, NoOpObservableGauge, unit, description
)[0]:
@@ -744,9 +731,6 @@
description: str = "",
) -> ObservableUpDownCounter:
"""Returns a no-op ObservableUpDownCounter."""
- super().create_observable_up_down_counter(
- name, callbacks, unit=unit, description=description
- )
if self._is_instrument_registered(
name, NoOpObservableUpDownCounter, unit, description
)[0]:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/propagate/__init__.py
new/opentelemetry_api-1.25.0/src/opentelemetry/propagate/__init__.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/propagate/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/propagate/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -109,8 +109,9 @@
"""Uses the configured propagator to inject a Context into the carrier.
Args:
- carrier: An object that contains a representation of HTTP
- headers. Should be paired with setter, which
+ carrier: the medium used by Propagators to read
+ values from and write values to.
+ Should be paired with setter, which
should know how to set header values on the carrier.
context: An optional Context to use. Defaults to current
context if not set.
@@ -148,7 +149,7 @@
raise ValueError(
f"Propagator {propagator} not found. It is either misspelled or
not installed."
)
- except Exception: # pylint: disable=broad-except
+ except Exception: # pylint: disable=broad-exception-caught
logger.exception("Failed to load propagator: %s", propagator)
raise
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/trace/__init__.py
new/opentelemetry_api-1.25.0/src/opentelemetry/trace/__init__.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/trace/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/trace/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -571,7 +571,7 @@
finally:
context_api.detach(token)
- except Exception as exc: # pylint: disable=broad-except
+ except Exception as exc: # pylint: disable=broad-exception-caught
if isinstance(span, Span) and span.is_recording():
# Record the exception as an event
if record_exception:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/trace/span.py
new/opentelemetry_api-1.25.0/src/opentelemetry/trace/span.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/trace/span.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/trace/span.py
2020-02-02 01:00:00.000000000 +0100
@@ -127,7 +127,8 @@
Adds a single `Link` with the `SpanContext` of the span to link to and,
optionally, attributes passed as arguments. Implementations may ignore
- calls with an invalid span context.
+ calls with an invalid span context if both attributes and TraceState
+ are empty.
Note: It is preferred to add links at span creation, instead of calling
this method later since samplers can only consider information already
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/util/_decorator.py
new/opentelemetry_api-1.25.0/src/opentelemetry/util/_decorator.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/util/_decorator.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/util/_decorator.py
2020-02-02 01:00:00.000000000 +0100
@@ -78,4 +78,5 @@
def helper(*args: Pargs, **kwargs: Pkwargs) -> _AgnosticContextManager[R]:
return _AgnosticContextManager(func, args, kwargs)
- return helper
+ # Ignoring the type to keep the original signature of the function
+ return helper # type: ignore[return-value]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/util/_providers.py
new/opentelemetry_api-1.25.0/src/opentelemetry/util/_providers.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/util/_providers.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/util/_providers.py
2020-02-02 01:00:00.000000000 +0100
@@ -29,7 +29,7 @@
def _load_provider(
provider_environment_variable: str, provider: str
-) -> Provider:
+) -> Provider: # type: ignore[type-var]
try:
@@ -49,6 +49,6 @@
)
).load()(),
)
- except Exception: # pylint: disable=broad-except
+ except Exception: # pylint: disable=broad-exception-caught
logger.exception("Failed to load configured provider %s", provider)
raise
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/src/opentelemetry/version.py
new/opentelemetry_api-1.25.0/src/opentelemetry/version.py
--- old/opentelemetry_api-1.24.0/src/opentelemetry/version.py 2020-02-02
01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/src/opentelemetry/version.py 2020-02-02
01:00:00.000000000 +0100
@@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-__version__ = "1.24.0"
+__version__ = "1.25.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/tests/attributes/test_attributes.py
new/opentelemetry_api-1.25.0/tests/attributes/test_attributes.py
--- old/opentelemetry_api-1.24.0/tests/attributes/test_attributes.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/tests/attributes/test_attributes.py
2020-02-02 01:00:00.000000000 +0100
@@ -180,3 +180,17 @@
bdict = BoundedAttributes()
with self.assertRaises(TypeError):
bdict["should-not-work"] = "dict immutable"
+
+ def test_locking(self):
+ """Supporting test case for a commit titled: Fix class
BoundedAttributes to have RLock rather than Lock. See #3858.
+ The change was introduced because __iter__ of the class
BoundedAttributes holds lock, and we observed some deadlock symptoms
+ in the codebase. This test case is to verify that the fix works as
expected.
+ """
+ bdict = BoundedAttributes(immutable=False)
+
+ with bdict._lock:
+ for num in range(100):
+ bdict[str(num)] = num
+
+ for num in range(100):
+ self.assertEqual(bdict[str(num)], num)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/tests/context/test_context.py
new/opentelemetry_api-1.25.0/tests/context/test_context.py
--- old/opentelemetry_api-1.24.0/tests/context/test_context.py 2020-02-02
01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/tests/context/test_context.py 2020-02-02
01:00:00.000000000 +0100
@@ -13,9 +13,12 @@
# limitations under the License.
import unittest
+from unittest.mock import patch
from opentelemetry import context
from opentelemetry.context.context import Context
+from opentelemetry.context.contextvars_context import ContextVarsRuntimeContext
+from opentelemetry.environment_variables import OTEL_PYTHON_CONTEXT
def _do_work() -> str:
@@ -74,3 +77,19 @@
context.detach(token)
self.assertEqual("yyy", context.get_value("a"))
+
+
+class TestInitContext(unittest.TestCase):
+ def test_load_runtime_context_default(self):
+ ctx = context._load_runtime_context() # pylint: disable=W0212
+ self.assertIsInstance(ctx, ContextVarsRuntimeContext)
+
+ @patch.dict("os.environ", {OTEL_PYTHON_CONTEXT: "contextvars_context"})
+ def test_load_runtime_context(self): # type: ignore[misc]
+ ctx = context._load_runtime_context() # pylint: disable=W0212
+ self.assertIsInstance(ctx, ContextVarsRuntimeContext)
+
+ @patch.dict("os.environ", {OTEL_PYTHON_CONTEXT: "foo"})
+ def test_load_runtime_context_fallback(self): # type: ignore[misc]
+ ctx = context._load_runtime_context() # pylint: disable=W0212
+ self.assertIsInstance(ctx, ContextVarsRuntimeContext)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/opentelemetry_api-1.24.0/tests/logs/test_proxy.py
new/opentelemetry_api-1.25.0/tests/logs/test_proxy.py
--- old/opentelemetry_api-1.24.0/tests/logs/test_proxy.py 2020-02-02
01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/tests/logs/test_proxy.py 2020-02-02
01:00:00.000000000 +0100
@@ -18,7 +18,6 @@
import opentelemetry._logs._internal as _logs_internal
from opentelemetry import _logs
-from opentelemetry.sdk._logs import LogRecord # type: ignore
from opentelemetry.test.globals_test import LoggingGlobalsTest
@@ -29,12 +28,12 @@
version: typing.Optional[str] = None,
schema_url: typing.Optional[str] = None,
) -> _logs.Logger:
- return TestLogger(name)
+ return LoggerTest(name)
-class TestLogger(_logs.NoOpLogger):
- def emit(self, *args, **kwargs):
- return LogRecord(timestamp=0)
+class LoggerTest(_logs.NoOpLogger):
+ def emit(self, record: _logs.LogRecord) -> None:
+ pass
class TestProxy(LoggingGlobalsTest, unittest.TestCase):
@@ -55,9 +54,9 @@
# logger provider now returns real instance
self.assertIsInstance(
- _logs.get_logger_provider().get_logger("fresh"), TestLogger
+ _logs.get_logger_provider().get_logger("fresh"), LoggerTest
)
# references to the old provider still work but return real logger now
real_logger = provider.get_logger("proxy-test")
- self.assertIsInstance(real_logger, TestLogger)
+ self.assertIsInstance(real_logger, LoggerTest)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/tests/metrics/test_observation.py
new/opentelemetry_api-1.25.0/tests/metrics/test_observation.py
--- old/opentelemetry_api-1.24.0/tests/metrics/test_observation.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/tests/metrics/test_observation.py
2020-02-02 01:00:00.000000000 +0100
@@ -25,7 +25,7 @@
# float
Observation(321.321, {"hello": "world"})
- except Exception: # pylint: disable=broad-except
+ except Exception: # pylint: disable=broad-exception-caught
self.fail(
"Unexpected exception raised when instantiating Observation"
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_api-1.24.0/tests/propagators/test_w3cbaggagepropagator.py
new/opentelemetry_api-1.25.0/tests/propagators/test_w3cbaggagepropagator.py
--- old/opentelemetry_api-1.24.0/tests/propagators/test_w3cbaggagepropagator.py
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/tests/propagators/test_w3cbaggagepropagator.py
2020-02-02 01:00:00.000000000 +0100
@@ -134,11 +134,13 @@
self._extract(
",".join(
[
- f"key{index}=value{index}"
- if index != 2
- else (
- f"key{index}="
- f"value{'s' *
(W3CBaggagePropagator._MAX_PAIR_LENGTH + 1)}"
+ (
+ f"key{index}=value{index}"
+ if index != 2
+ else (
+ f"key{index}="
+ f"value{'s' *
(W3CBaggagePropagator._MAX_PAIR_LENGTH + 1)}"
+ )
)
for index in range(
W3CBaggagePropagator._MAX_PAIRS + 1
@@ -162,9 +164,11 @@
self._extract(
",".join(
[
- f"key{index}=value{index}"
- if index != 2
- else f"key{index}xvalue{index}"
+ (
+ f"key{index}=value{index}"
+ if index != 2
+ else f"key{index}xvalue{index}"
+ )
for index in range(
W3CBaggagePropagator._MAX_PAIRS + 1
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/opentelemetry_api-1.24.0/tests/trace/test_globals.py
new/opentelemetry_api-1.25.0/tests/trace/test_globals.py
--- old/opentelemetry_api-1.24.0/tests/trace/test_globals.py 2020-02-02
01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/tests/trace/test_globals.py 2020-02-02
01:00:00.000000000 +0100
@@ -7,7 +7,7 @@
from opentelemetry.trace.status import Status, StatusCode
-class TestSpan(trace.NonRecordingSpan):
+class SpanTest(trace.NonRecordingSpan):
has_ended = False
recorded_exception = None
recorded_status = Status(status_code=StatusCode.UNSET)
@@ -110,7 +110,7 @@
def test_use_span_end_on_exit(self):
- test_span = TestSpan(trace.INVALID_SPAN_CONTEXT)
+ test_span = SpanTest(trace.INVALID_SPAN_CONTEXT)
with trace.use_span(test_span):
pass
@@ -124,7 +124,7 @@
class TestUseSpanException(Exception):
pass
- test_span = TestSpan(trace.INVALID_SPAN_CONTEXT)
+ test_span = SpanTest(trace.INVALID_SPAN_CONTEXT)
exception = TestUseSpanException("test exception")
with self.assertRaises(TestUseSpanException):
with trace.use_span(test_span):
@@ -136,7 +136,7 @@
class TestUseSpanException(Exception):
pass
- test_span = TestSpan(trace.INVALID_SPAN_CONTEXT)
+ test_span = SpanTest(trace.INVALID_SPAN_CONTEXT)
with self.assertRaises(TestUseSpanException):
with trace.use_span(test_span):
raise TestUseSpanException("test error")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/opentelemetry_api-1.24.0/tests/trace/test_proxy.py
new/opentelemetry_api-1.25.0/tests/trace/test_proxy.py
--- old/opentelemetry_api-1.24.0/tests/trace/test_proxy.py 2020-02-02
01:00:00.000000000 +0100
+++ new/opentelemetry_api-1.25.0/tests/trace/test_proxy.py 2020-02-02
01:00:00.000000000 +0100
@@ -38,7 +38,7 @@
class TestTracer(trace.NoOpTracer):
def start_span(self, *args, **kwargs):
- return TestSpan(INVALID_SPAN_CONTEXT)
+ return SpanTest(INVALID_SPAN_CONTEXT)
@_agnosticcontextmanager # pylint: disable=protected-access
def start_as_current_span(self, *args, **kwargs): # type: ignore
@@ -46,7 +46,7 @@
yield span
-class TestSpan(NonRecordingSpan):
+class SpanTest(NonRecordingSpan):
pass
@@ -82,7 +82,7 @@
# reference to old proxy tracer now delegates to a real tracer and
# creates real spans
with tracer.start_span("") as span:
- self.assertIsInstance(span, TestSpan)
+ self.assertIsInstance(span, SpanTest)
def test_late_config(self):
# get a tracer and instrument a function as we would at the
@@ -100,4 +100,4 @@
# configure tracing provider
trace.set_tracer_provider(TestProvider())
# call function again, we should now be getting a TestSpan
- self.assertIsInstance(my_function(), TestSpan)
+ self.assertIsInstance(my_function(), SpanTest)