Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package
python-opentelemetry-exporter-otlp-proto-common for openSUSE:Factory checked in
at 2026-07-21 22:55:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing
/work/SRC/openSUSE:Factory/python-opentelemetry-exporter-otlp-proto-common (Old)
and
/work/SRC/openSUSE:Factory/.python-opentelemetry-exporter-otlp-proto-common.new.24530
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-opentelemetry-exporter-otlp-proto-common"
Tue Jul 21 22:55:36 2026 rev:18 rq:1365745 version:1.43.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-opentelemetry-exporter-otlp-proto-common/python-opentelemetry-exporter-otlp-proto-common.changes
2026-06-27 18:05:46.447318626 +0200
+++
/work/SRC/openSUSE:Factory/.python-opentelemetry-exporter-otlp-proto-common.new.24530/python-opentelemetry-exporter-otlp-proto-common.changes
2026-07-21 22:56:21.165398397 +0200
@@ -1,0 +2,99 @@
+Tue Jul 7 19:01:17 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 1.43.0:
+ * ### Added
+ * `opentelemetry-sdk`: add `add_metric_reader` /
+ `remove_metric_reader` public APIs to register / unregister
+ metric readers at runtime.
+ * `opentelemetry-exporter-prometheus`: add support for
+ configuring metric scope labels
+ * `opentelemetry-exporter-otlp-proto-grpc`: Add grpc error
+ details to the log message that's written when the grpc call
+ fails.
+ * `opentelemetry-exporter-http-transport`: add 'opentelemetry-
+ exporter-http-transport' package for HTTP exporters
+ * `opentelemetry-sdk`: Add `composite/development` samplers
+ support to declarative file configuration
+ * `opentelemetry-exporter-otlp-json-file`: Add OTLP JSON File
+ exporter implementation
+ * `opentelemetry-sdk`: add `_resolve_component` shared utility
+ for declarative config plugin loading, reducing boilerplate
+ in exporter factory functions
+ * `opentelemetry-sdk`: add pull metric reader support to
+ declarative file configuration, including Prometheus metric
+ reader via the `prometheus_development` config field
+ * `opentelemetry-proto-json`: update to use opentelemetry-proto
+ v1.10.0
+ * `opentelemetry-proto`: bump maximum supported protobuf
+ version to 7.x.x
+ * `opentelemetry-sdk`: add `ServiceInstanceIdResourceDetector`
+ for populating `service.instance.id`
+ * `opentelemetry-sdk`: declarative config loader now
+ recursively converts parsed dicts into typed dataclass
+ instances, including nested dataclasses, lists of
+ dataclasses, and enum values. End-to-end YAML/JSON → SDK
+ configuration now works via the factory functions.
+ * `opentelemetry-sdk`: add `configure_sdk(config)` to the
+ declarative configuration API. Single entry point that takes
+ a parsed `OpenTelemetryConfiguration`, builds the resource,
+ and applies the tracer/meter/logger providers and propagator
+ globally. Honors the top-level `disabled` flag.
+ * `opentelemetry-sdk`: the SDK configurator now honors the
+ `OTEL_CONFIG_FILE` environment variable. When set, the SDK
+ loads and applies the referenced declarative configuration
+ file (YAML or JSON) in place of the env-var-based init path.
+ * `opentelemetry-sdk`: update declarative config to use
+ `ServiceInstanceIdResourceDetector`
+ * `opentelemetry-exporter-otlp-proto-common`, `opentelemetry-
+ exporter-otlp-json-common`: encoders now always accept null,
+ and encode it as an empty `AnyValue` in accordance with the
+ spec.
+ * `opentelemetry-sdk`: validate the declarative config
+ `file_format` version — reject an unsupported major version
+ and warn on a newer minor version, per the configuration spec
+ versioning rules
+ * `opentelemetry-exporter-http-transport`: enable entry-point
+ loading of transport implementations
+ * ### Changed
+ * `opentelemetry-sdk`: introduce experimental entry points for
+ OpAMP agent integration
+ * `opentelemetry-api`: conditionally import entrypoints for
+ `opentelemetry_context` only if the `OTEL_PYTHON_CONTEXT` env
+ variable is defined, return `ContextVarsRuntimeContext`
+ otherwise
+ * `opentelemetry-sdk`: rename "known/unknown" to "built-
+ in/user-defined" terminology in declarative config component
+ loading code
+ * `opentelemetry-proto`: regenerate protobuf code from
+ opentelemetry-proto v1.10.0
+ * `opentelemetry-sdk`: remove unnecessary `copy` in Span
+ creation
+ * opentelemetry-sdk: remove unnecessary dict in set_attribute
+ method
+ * `opentelemetry-sdk`: inline the method
+ `_clean_attribute_value`
+ * Remove typing aliases deprecated in python 3.9 and replace
+ all usages of `typing.Union` and `typing.Optional` with `|`.
+ * opentelemetry-sdk: remove generator in the accessor for
+ links/events
+ * opentelemetry-api: remove unnecessary copy in iterator
+ * `opentelemetry-api`: update `EnvironmentGetter` to ignore
+ non-normalized environment variable names
+ * opentelemetry-sdk: update iterator for BoundedList
+ * opentelemetry-sdk: reduce lock contention in attributes
+ * opentelemetry-sdk: merge doesn't need a copy, dict already
+ does this
+ * `opentelemetry-api`: normalize empty environment propagation
+ names to `_` in `EnvironmentSetter` and `EnvironmentGetter`
+ * ### Fixed
+ * Add missing `.rst` files to Sphinx documentation build for
+ SDK logs, propagators, and exporter submodules.
+ * Preserve the random trace ID flag when creating child spans
+ instead of always setting the random trace id bit depending
+ on the available trace id generator.
+ * `opentelemetry-api`: fix SelectableGroups deprecation warning
+ * `opentelemetry-sdk`: make
+ `SynchronousMeasurementConsumer.consume_measurement` lock
+ free to avoid deadlocks
+
+-------------------------------------------------------------------
Old:
----
opentelemetry_exporter_otlp_proto_common-1.42.1.tar.gz
New:
----
opentelemetry_exporter_otlp_proto_common-1.43.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-opentelemetry-exporter-otlp-proto-common.spec ++++++
--- /var/tmp/diff_new_pack.ll1Nm3/_old 2026-07-21 22:56:21.653415203 +0200
+++ /var/tmp/diff_new_pack.ll1Nm3/_new 2026-07-21 22:56:21.657415341 +0200
@@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-opentelemetry-exporter-otlp-proto-common
-Version: 1.42.1
+Version: 1.43.0
Release: 0
Summary: OpenTelemetry Protobuf encoding
License: Apache-2.0
++++++ opentelemetry_exporter_otlp_proto_common-1.42.1.tar.gz ->
opentelemetry_exporter_otlp_proto_common-1.43.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_exporter_otlp_proto_common-1.42.1/PKG-INFO
new/opentelemetry_exporter_otlp_proto_common-1.43.0/PKG-INFO
--- old/opentelemetry_exporter_otlp_proto_common-1.42.1/PKG-INFO
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_exporter_otlp_proto_common-1.43.0/PKG-INFO
2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: opentelemetry-exporter-otlp-proto-common
-Version: 1.42.1
+Version: 1.43.0
Summary: OpenTelemetry Protobuf encoding
Project-URL: Homepage,
https://github.com/open-telemetry/opentelemetry-python/tree/main/exporter/opentelemetry-exporter-otlp-proto-common
Project-URL: Repository, https://github.com/open-telemetry/opentelemetry-python
@@ -19,7 +19,7 @@
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
-Requires-Dist: opentelemetry-proto==1.42.1
+Requires-Dist: opentelemetry-proto==1.43.0
Description-Content-Type: text/x-rst
OpenTelemetry Protobuf Encoding
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_exporter_otlp_proto_common-1.42.1/pyproject.toml
new/opentelemetry_exporter_otlp_proto_common-1.43.0/pyproject.toml
--- old/opentelemetry_exporter_otlp_proto_common-1.42.1/pyproject.toml
2020-02-02 01:00:00.000000000 +0100
+++ new/opentelemetry_exporter_otlp_proto_common-1.43.0/pyproject.toml
2020-02-02 01:00:00.000000000 +0100
@@ -26,7 +26,7 @@
"Programming Language :: Python :: 3.14",
]
dependencies = [
- "opentelemetry-proto == 1.42.1",
+ "opentelemetry-proto == 1.43.0",
]
[project.urls]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_exporter_otlp_proto_common-1.42.1/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py
new/opentelemetry_exporter_otlp_proto_common-1.43.0/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py
---
old/opentelemetry_exporter_otlp_proto_common-1.42.1/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++
new/opentelemetry_exporter_otlp_proto_common-1.43.0/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -51,9 +51,9 @@
return PB2Resource(attributes=_encode_attributes(resource.attributes))
-def _encode_value(value: Any, allow_null: bool = False) -> PB2AnyValue | None:
- if allow_null is True and value is None:
- return None
+def _encode_value(value: Any) -> PB2AnyValue:
+ if value is None:
+ return PB2AnyValue()
if isinstance(value, bool):
return PB2AnyValue(bool_value=value)
if isinstance(value, str):
@@ -66,45 +66,19 @@
return PB2AnyValue(bytes_value=value)
if isinstance(value, Sequence):
return PB2AnyValue(
- array_value=PB2ArrayValue(
- values=_encode_array(value, allow_null=allow_null)
- )
+ array_value=PB2ArrayValue(values=[_encode_value(v) for v in value])
)
- elif isinstance(value, Mapping):
+ if isinstance(value, Mapping):
return PB2AnyValue(
kvlist_value=PB2KeyValueList(
- values=[
- _encode_key_value(str(k), v, allow_null=allow_null)
- for k, v in value.items()
- ]
+ values=[_encode_key_value(str(k), v) for k, v in value.items()]
)
)
raise Exception(f"Invalid type {type(value)} of value {value}")
-def _encode_key_value(
- key: str, value: Any, allow_null: bool = False
-) -> PB2KeyValue:
- return PB2KeyValue(
- key=key, value=_encode_value(value, allow_null=allow_null)
- )
-
-
-def _encode_array(
- array: Sequence[Any], allow_null: bool = False
-) -> Sequence[PB2AnyValue]:
- if not allow_null:
- # Let the exception get raised by _encode_value()
- return [_encode_value(v, allow_null=allow_null) for v in array]
-
- return [
- _encode_value(v, allow_null=allow_null)
- if v is not None
- # Use an empty AnyValue to represent None in an array. Behavior may
change pending
- #
https://github.com/open-telemetry/opentelemetry-specification/issues/4392
- else PB2AnyValue()
- for v in array
- ]
+def _encode_key_value(key: str, value: Any) -> PB2KeyValue:
+ return PB2KeyValue(key=key, value=_encode_value(value))
def _encode_span_id(span_id: int) -> bytes:
@@ -116,21 +90,17 @@
def _encode_attributes(
- attributes: _ExtendedAttributes,
- allow_null: bool = False,
-) -> list[PB2KeyValue] | None:
- if attributes:
- pb2_attributes = []
- for key, value in attributes.items():
- # pylint: disable=broad-exception-caught
- try:
- pb2_attributes.append(
- _encode_key_value(key, value, allow_null=allow_null)
- )
- except Exception as error:
- _logger.exception("Failed to encode key %s: %s", key, error)
- else:
- pb2_attributes = None
+ attributes: _ExtendedAttributes | None,
+) -> list[PB2KeyValue]:
+ if not attributes:
+ return []
+ pb2_attributes = []
+ for key, value in attributes.items():
+ # pylint: disable=broad-exception-caught
+ try:
+ pb2_attributes.append(_encode_key_value(key, value))
+ except Exception as error:
+ _logger.exception("Failed to encode key %s: %s", key, error)
return pb2_attributes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_exporter_otlp_proto_common-1.42.1/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py
new/opentelemetry_exporter_otlp_proto_common-1.43.0/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py
---
old/opentelemetry_exporter_otlp_proto_common-1.42.1/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++
new/opentelemetry_exporter_otlp_proto_common-1.43.0/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -39,17 +39,16 @@
if readable_log_record.log_record.trace_id == 0
else _encode_trace_id(readable_log_record.log_record.trace_id)
)
- body = readable_log_record.log_record.body
return PB2LogRecord(
time_unix_nano=readable_log_record.log_record.timestamp,
observed_time_unix_nano=readable_log_record.log_record.observed_timestamp,
span_id=span_id,
trace_id=trace_id,
flags=int(readable_log_record.log_record.trace_flags),
- body=_encode_value(body, allow_null=True),
+ body=_encode_value(readable_log_record.log_record.body),
severity_text=readable_log_record.log_record.severity_text,
attributes=_encode_attributes(
- readable_log_record.log_record.attributes, allow_null=True
+ readable_log_record.log_record.attributes
),
dropped_attributes_count=readable_log_record.dropped_attributes,
severity_number=getattr(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_exporter_otlp_proto_common-1.42.1/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py
new/opentelemetry_exporter_otlp_proto_common-1.43.0/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py
---
old/opentelemetry_exporter_otlp_proto_common-1.42.1/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py
2020-02-02 01:00:00.000000000 +0100
+++
new/opentelemetry_exporter_otlp_proto_common-1.43.0/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py
2020-02-02 01:00:00.000000000 +0100
@@ -1,4 +1,4 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
-__version__ = "1.42.1"
+__version__ = "1.43.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_exporter_otlp_proto_common-1.42.1/tests/test_attribute_encoder.py
new/opentelemetry_exporter_otlp_proto_common-1.43.0/tests/test_attribute_encoder.py
---
old/opentelemetry_exporter_otlp_proto_common-1.42.1/tests/test_attribute_encoder.py
2020-02-02 01:00:00.000000000 +0100
+++
new/opentelemetry_exporter_otlp_proto_common-1.43.0/tests/test_attribute_encoder.py
2020-02-02 01:00:00.000000000 +0100
@@ -14,6 +14,11 @@
from opentelemetry.proto.common.v1.common_pb2 import KeyValue as PB2KeyValue
+class CallingStrRaisesException:
+ def __str__(self):
+ raise ValueError("Cannot encode")
+
+
class TestOTLPAttributeEncoder(unittest.TestCase):
def test_encode_attributes_all_kinds(self):
result = _encode_attributes(
@@ -77,30 +82,14 @@
],
)
- def test_encode_attributes_error_list_none(self):
+ def test_encode_attributes_error_logs_key(self):
with self.assertLogs(level=ERROR) as error:
result = _encode_attributes(
- {"a": 1, "bad_key": ["test", None, "test"], "b": 2}
+ {"a": 1, "bad_key": CallingStrRaisesException(), "b": 2}
)
self.assertEqual(len(error.records), 1)
self.assertEqual(error.records[0].msg, "Failed to encode key %s: %s")
- self.assertEqual(error.records[0].args[0], "bad_key")
- self.assertIsInstance(error.records[0].args[1], Exception)
- self.assertEqual(
- result,
- [
- PB2KeyValue(key="a", value=PB2AnyValue(int_value=1)),
- PB2KeyValue(key="b", value=PB2AnyValue(int_value=2)),
- ],
- )
-
- def test_encode_attributes_error_logs_key(self):
- with self.assertLogs(level=ERROR) as error:
- result = _encode_attributes({"a": 1, "bad_key": None, "b": 2})
-
- self.assertEqual(len(error.records), 1)
- self.assertEqual(error.records[0].msg, "Failed to encode key %s: %s")
self.assertEqual(error.records[0].args[0], "bad_key")
self.assertIsInstance(error.records[0].args[1], Exception)
self.assertEqual(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/opentelemetry_exporter_otlp_proto_common-1.42.1/tests/test_log_encoder.py
new/opentelemetry_exporter_otlp_proto_common-1.43.0/tests/test_log_encoder.py
---
old/opentelemetry_exporter_otlp_proto_common-1.42.1/tests/test_log_encoder.py
2020-02-02 01:00:00.000000000 +0100
+++
new/opentelemetry_exporter_otlp_proto_common-1.43.0/tests/test_log_encoder.py
2020-02-02 01:00:00.000000000 +0100
@@ -16,15 +16,9 @@
)
from opentelemetry.proto.common.v1.common_pb2 import AnyValue as PB2AnyValue
from opentelemetry.proto.common.v1.common_pb2 import (
- ArrayValue as PB2ArrayValue,
-)
-from opentelemetry.proto.common.v1.common_pb2 import (
InstrumentationScope as PB2InstrumentationScope,
)
from opentelemetry.proto.common.v1.common_pb2 import KeyValue as PB2KeyValue
-from opentelemetry.proto.common.v1.common_pb2 import (
- KeyValueList as PB2KeyValueList,
-)
from opentelemetry.proto.logs.v1.logs_pb2 import LogRecord as PB2LogRecord
from opentelemetry.proto.logs.v1.logs_pb2 import (
ResourceLogs as PB2ResourceLogs,
@@ -43,55 +37,25 @@
set_span_in_context,
)
-
-class TestOTLPLogEncoder(unittest.TestCase):
- def test_encode(self):
- sdk_logs, expected_encoding = self.get_test_logs()
- self.assertEqual(encode_logs(sdk_logs), expected_encoding)
-
- def test_encode_no_body(self):
- sdk_logs, expected_encoding = self.get_test_logs()
- for log in sdk_logs:
- log.log_record.body = None
-
- for resource_log in expected_encoding.resource_logs:
- for scope_log in resource_log.scope_logs:
- for log_record in scope_log.log_records:
- log_record.ClearField("body")
-
- self.assertEqual(encode_logs(sdk_logs), expected_encoding)
-
- def test_dropped_attributes_count(self):
- sdk_logs = self._get_test_logs_dropped_attributes()
- encoded_logs = encode_logs(sdk_logs)
- self.assertTrue(hasattr(sdk_logs[0], "dropped_attributes"))
- self.assertEqual(
- # pylint:disable=no-member
- encoded_logs.resource_logs[0]
- .scope_logs[0]
- .log_records[0]
- .dropped_attributes_count,
- 2,
+_CONTEXT_LOG = set_span_in_context(
+ NonRecordingSpan(
+ SpanContext(
+ 89564621134313219400156819398935297684,
+ 1312458408527513268,
+ False,
+ TraceFlags(0x01),
)
+ )
+)
- @staticmethod
- def _get_sdk_log_data() -> list[ReadWriteLogRecord]:
- # pylint:disable=too-many-locals
- ctx_log1 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 89564621134313219400156819398935297684,
- 1312458408527513268,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log1 = ReadWriteLogRecord(
+
+class TestOTLPLogEncoder(unittest.TestCase):
+ def test_encode_basic_log_record(self):
+ basic_log_record = ReadWriteLogRecord(
LogRecord(
timestamp=1644650195189786880,
observed_timestamp=1644650195189786881,
- context=ctx_log1,
+ context=_CONTEXT_LOG,
severity_text="WARN",
severity_number=SeverityNumber.WARN,
body="Do not go gentle into that good night. Rage, rage
against the dying of the light",
@@ -105,222 +69,6 @@
"first_name", "first_version"
),
)
-
- log2 = ReadWriteLogRecord(
- LogRecord(
- timestamp=1644650249738562048,
- observed_timestamp=1644650249738562049,
- severity_text="WARN",
- severity_number=SeverityNumber.WARN,
- body="Cooper, this is no time for caution!",
- attributes={},
- ),
- resource=SDKResource({"second_resource": "CASE"}),
- instrumentation_scope=InstrumentationScope(
- "second_name", "second_version"
- ),
- )
-
- ctx_log3 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 271615924622795969659406376515024083555,
- 4242561578944770265,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log3 = ReadWriteLogRecord(
- LogRecord(
- timestamp=1644650427658989056,
- observed_timestamp=1644650427658989057,
- context=ctx_log3,
- severity_text="DEBUG",
- severity_number=SeverityNumber.DEBUG,
- body="To our galaxy",
- attributes={"a": 1, "b": "c"},
- ),
- resource=SDKResource({"second_resource": "CASE"}),
- instrumentation_scope=None,
- )
-
- ctx_log4 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 212592107417388365804938480559624925555,
- 6077757853989569223,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log4 = ReadWriteLogRecord(
- LogRecord(
- timestamp=1644650584292683008,
- observed_timestamp=1644650584292683009,
- context=ctx_log4,
- severity_text="INFO",
- severity_number=SeverityNumber.INFO,
- body="Love is the one thing that transcends time and space",
- attributes={"filename": "model.py", "func_name": "run_method"},
- ),
- resource=SDKResource(
- {"first_resource": "value"},
- "resource_schema_url",
- ),
- instrumentation_scope=InstrumentationScope(
- "another_name", "another_version"
- ),
- )
-
- ctx_log5 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 212592107417388365804938480559624925555,
- 6077757853989569445,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log5 = ReadWriteLogRecord(
- LogRecord(
- timestamp=1644650584292683009,
- observed_timestamp=1644650584292683010,
- context=ctx_log5,
- severity_text="INFO",
- severity_number=SeverityNumber.INFO,
- body={"error": None, "array_with_nones": [1, None, 2]},
- attributes={},
- ),
- resource=SDKResource({}),
- instrumentation_scope=InstrumentationScope(
- "last_name", "last_version"
- ),
- )
-
- ctx_log6 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 212592107417388365804938480559624925522,
- 6077757853989569222,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log6 = ReadWriteLogRecord(
- LogRecord(
- timestamp=1644650584292683022,
- observed_timestamp=1644650584292683022,
- context=ctx_log6,
- severity_text="ERROR",
- severity_number=SeverityNumber.ERROR,
- body="This instrumentation scope has a schema url",
- attributes={"filename": "model.py", "func_name": "run_method"},
- ),
- resource=SDKResource(
- {"first_resource": "value"},
- "resource_schema_url",
- ),
- instrumentation_scope=InstrumentationScope(
- "scope_with_url",
- "scope_with_url_version",
- "instrumentation_schema_url",
- ),
- )
-
- ctx_log7 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 212592107417388365804938480559624925533,
- 6077757853989569233,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log7 = ReadWriteLogRecord(
- LogRecord(
- timestamp=1644650584292683033,
- observed_timestamp=1644650584292683033,
- context=ctx_log7,
- severity_text="FATAL",
- severity_number=SeverityNumber.FATAL,
- body="This instrumentation scope has a schema url and
attributes",
- attributes={"filename": "model.py", "func_name": "run_method"},
- ),
- resource=SDKResource(
- {"first_resource": "value"},
- "resource_schema_url",
- ),
- instrumentation_scope=InstrumentationScope(
- "scope_with_attributes",
- "scope_with_attributes_version",
- "instrumentation_schema_url",
- {"one": 1, "two": "2"},
- ),
- )
-
- ctx_log8 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 212592107417388365804938480559624925566,
- 6077757853989569466,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log8 = ReadWriteLogRecord(
- LogRecord(
- timestamp=1644650584292683044,
- observed_timestamp=1644650584292683044,
- context=ctx_log8,
- severity_text="INFO",
- severity_number=SeverityNumber.INFO,
- body="Test export of extended attributes",
- attributes={
- "extended": {
- "sequence": [{"inner": "mapping", "none": None}]
- }
- },
- ),
- resource=SDKResource({}),
- instrumentation_scope=InstrumentationScope(
- "extended_name", "extended_version"
- ),
- )
-
- ctx_log9 = set_span_in_context(
- NonRecordingSpan(
- SpanContext(
- 212592107417388365804938480559624925566,
- 6077757853989569466,
- False,
- TraceFlags(0x01),
- )
- )
- )
- log9 = ReadWriteLogRecord(
- LogRecord(
- # these are otherwise set by default
- observed_timestamp=1644650584292683045,
- context=ctx_log9,
- ),
- resource=SDKResource({}),
- instrumentation_scope=InstrumentationScope(
- "empty_log_record_name", "empty_log_record_version"
- ),
- )
- return [log1, log2, log3, log4, log5, log6, log7, log8, log9]
-
- def get_test_logs(
- self,
- ) -> tuple[list[ReadWriteLogRecord], ExportLogsServiceRequest]:
- sdk_logs = self._get_sdk_log_data()
-
pb2_service_request = ExportLogsServiceRequest(
resource_logs=[
PB2ResourceLogs(
@@ -354,284 +102,160 @@
"Do not go gentle into that good
night. Rage, rage against the dying of the light"
),
attributes=_encode_attributes(
- {"a": 1, "b": "c"},
- allow_null=True,
- ),
- )
- ],
- ),
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(
- name="another_name",
- version="another_version",
- ),
- log_records=[
- PB2LogRecord(
- time_unix_nano=1644650584292683008,
-
observed_time_unix_nano=1644650584292683009,
- trace_id=_encode_trace_id(
- 212592107417388365804938480559624925555
- ),
- span_id=_encode_span_id(
- 6077757853989569223
- ),
- flags=int(TraceFlags(0x01)),
- severity_text="INFO",
- severity_number=SeverityNumber.INFO.value,
- body=_encode_value(
- "Love is the one thing that transcends
time and space"
- ),
- attributes=_encode_attributes(
- {
- "filename": "model.py",
- "func_name": "run_method",
- },
- allow_null=True,
- ),
- )
- ],
- ),
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(
- name="scope_with_url",
- version="scope_with_url_version",
- ),
- schema_url="instrumentation_schema_url",
- log_records=[
- PB2LogRecord(
- time_unix_nano=1644650584292683022,
-
observed_time_unix_nano=1644650584292683022,
- trace_id=_encode_trace_id(
- 212592107417388365804938480559624925522
- ),
- span_id=_encode_span_id(
- 6077757853989569222
- ),
- flags=int(TraceFlags(0x01)),
- severity_text="ERROR",
- severity_number=SeverityNumber.ERROR.value,
- body=_encode_value(
- "This instrumentation scope has a
schema url"
- ),
- attributes=_encode_attributes(
- {
- "filename": "model.py",
- "func_name": "run_method",
- },
- allow_null=True,
- ),
- )
- ],
- ),
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(
- name="scope_with_attributes",
- version="scope_with_attributes_version",
- attributes=_encode_attributes(
- {"one": 1, "two": "2"},
- allow_null=True,
- ),
- ),
- schema_url="instrumentation_schema_url",
- log_records=[
- PB2LogRecord(
- time_unix_nano=1644650584292683033,
-
observed_time_unix_nano=1644650584292683033,
- trace_id=_encode_trace_id(
- 212592107417388365804938480559624925533
- ),
- span_id=_encode_span_id(
- 6077757853989569233
- ),
- flags=int(TraceFlags(0x01)),
- severity_text="FATAL",
- severity_number=SeverityNumber.FATAL.value,
- body=_encode_value(
- "This instrumentation scope has a
schema url and attributes"
- ),
- attributes=_encode_attributes(
- {
- "filename": "model.py",
- "func_name": "run_method",
- },
- allow_null=True,
+ {"a": 1, "b": "c"}
),
)
],
),
],
schema_url="resource_schema_url",
+ )
+ ]
+ )
+ self.assertEqual(encode_logs([basic_log_record]), pb2_service_request)
+
+ def test_encode_log_record_with_no_instrumentation_scope_and_dict_body(
+ self,
+ ):
+ log_record_with_no_instrumentation_scope_and_dict_body = (
+ ReadWriteLogRecord(
+ LogRecord(
+ timestamp=1644650427658989056,
+ observed_timestamp=1644650427658989057,
+ context=_CONTEXT_LOG,
+ severity_text="DEBUG",
+ severity_number=SeverityNumber.DEBUG,
+ body={"error": None, "array_with_nones": [1, None, 2]},
+ attributes={"a": 1, "b": "c"},
),
- PB2ResourceLogs(
- resource=PB2Resource(
- attributes=[
- PB2KeyValue(
- key="second_resource",
- value=PB2AnyValue(string_value="CASE"),
- )
- ]
- ),
- scope_logs=[
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(
- name="second_name",
- version="second_version",
+ resource=SDKResource({"second_resource": "CASE"}),
+ instrumentation_scope=None,
+ )
+ )
+ pb2_resource_logs = PB2ResourceLogs(
+ resource=PB2Resource(
+ attributes=[
+ PB2KeyValue(
+ key="second_resource",
+ value=PB2AnyValue(string_value="CASE"),
+ )
+ ]
+ ),
+ scope_logs=[
+ PB2ScopeLogs(
+ scope=PB2InstrumentationScope(),
+ log_records=[
+ PB2LogRecord(
+ time_unix_nano=1644650427658989056,
+ observed_time_unix_nano=1644650427658989057,
+ trace_id=_encode_trace_id(
+ 89564621134313219400156819398935297684
+ ),
+ span_id=_encode_span_id(1312458408527513268),
+ flags=int(TraceFlags(0x01)),
+ severity_text="DEBUG",
+ severity_number=SeverityNumber.DEBUG.value,
+ body=_encode_value(
+ {
+ "error": None,
+ "array_with_nones": [1, None, 2],
+ }
),
- log_records=[
- PB2LogRecord(
- time_unix_nano=1644650249738562048,
-
observed_time_unix_nano=1644650249738562049,
- trace_id=None,
- span_id=None,
- flags=int(TraceFlags.DEFAULT),
- severity_text="WARN",
- severity_number=SeverityNumber.WARN.value,
- body=_encode_value(
- "Cooper, this is no time for caution!"
- ),
- attributes={},
- ),
- ],
- ),
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(),
- log_records=[
- PB2LogRecord(
- time_unix_nano=1644650427658989056,
-
observed_time_unix_nano=1644650427658989057,
- trace_id=_encode_trace_id(
- 271615924622795969659406376515024083555
- ),
- span_id=_encode_span_id(
- 4242561578944770265
- ),
- flags=int(TraceFlags(0x01)),
- severity_text="DEBUG",
- severity_number=SeverityNumber.DEBUG.value,
- body=_encode_value("To our galaxy"),
- attributes=_encode_attributes(
- {"a": 1, "b": "c"},
- allow_null=True,
- ),
- ),
- ],
- ),
+ attributes=_encode_attributes({"a": 1, "b": "c"}),
+ )
],
- ),
- PB2ResourceLogs(
- resource=PB2Resource(),
- scope_logs=[
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(
- name="last_name",
- version="last_version",
- ),
- log_records=[
- PB2LogRecord(
- time_unix_nano=1644650584292683009,
-
observed_time_unix_nano=1644650584292683010,
- trace_id=_encode_trace_id(
- 212592107417388365804938480559624925555
- ),
- span_id=_encode_span_id(
- 6077757853989569445,
- ),
- flags=int(TraceFlags(0x01)),
- severity_text="INFO",
- severity_number=SeverityNumber.INFO.value,
- body=PB2AnyValue(
- kvlist_value=PB2KeyValueList(
- values=[
- PB2KeyValue(key="error"),
- PB2KeyValue(
- key="array_with_nones",
- value=PB2AnyValue(
-
array_value=PB2ArrayValue(
- values=[
- PB2AnyValue(
- int_value=1
- ),
- PB2AnyValue(),
- PB2AnyValue(
- int_value=2
- ),
- ]
- )
- ),
- ),
- ]
- )
- ),
- attributes={},
- ),
- ],
- ),
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(
- name="extended_name",
- version="extended_version",
- ),
- log_records=[
- PB2LogRecord(
- time_unix_nano=1644650584292683044,
-
observed_time_unix_nano=1644650584292683044,
- trace_id=_encode_trace_id(
- 212592107417388365804938480559624925566
- ),
- span_id=_encode_span_id(
- 6077757853989569466,
- ),
- flags=int(TraceFlags(0x01)),
- severity_text="INFO",
- severity_number=SeverityNumber.INFO.value,
- body=_encode_value(
- "Test export of extended attributes"
- ),
- attributes=_encode_attributes(
- {
- "extended": {
- "sequence": [
- {
- "inner": "mapping",
- "none": None,
- }
- ]
- }
- },
- allow_null=True,
- ),
- ),
- ],
- ),
- PB2ScopeLogs(
- scope=PB2InstrumentationScope(
- name="empty_log_record_name",
- version="empty_log_record_version",
+ )
+ ],
+ )
+ self.assertEqual(
+ encode_logs(
+ [log_record_with_no_instrumentation_scope_and_dict_body]
+ ),
+ ExportLogsServiceRequest(resource_logs=[pb2_resource_logs]),
+ )
+
+ def test_encode_log_record_with_empty_resource_and_dict_attribute_value(
+ self,
+ ):
+ log_record_with_empty_resource_and_dict_attribute_value =
ReadWriteLogRecord(
+ LogRecord(
+ timestamp=1644650584292683033,
+ observed_timestamp=1644650584292683033,
+ context=_CONTEXT_LOG,
+ severity_text="FATAL",
+ severity_number=SeverityNumber.FATAL,
+ body="This instrumentation scope has a schema url and
attributes",
+ attributes={
+ "extended": {
+ "sequence": [{"inner": "mapping", "none": None}]
+ }
+ },
+ ),
+ resource=SDKResource({}),
+ instrumentation_scope=InstrumentationScope(
+ "scope_with_attributes",
+ "scope_with_attributes_version",
+ "instrumentation_schema_url",
+ {"one": 1, "two": "2"},
+ ),
+ )
+ pb2_resource_logs = PB2ResourceLogs(
+ resource=PB2Resource(attributes=[]),
+ scope_logs=[
+ PB2ScopeLogs(
+ scope=PB2InstrumentationScope(
+ name="scope_with_attributes",
+ version="scope_with_attributes_version",
+ attributes=_encode_attributes({"one": 1, "two": "2"}),
+ ),
+ log_records=[
+ PB2LogRecord(
+ time_unix_nano=1644650584292683033,
+ observed_time_unix_nano=1644650584292683033,
+ trace_id=_encode_trace_id(
+ 89564621134313219400156819398935297684
+ ),
+ span_id=_encode_span_id(1312458408527513268),
+ flags=int(TraceFlags(0x01)),
+ severity_text="FATAL",
+ severity_number=SeverityNumber.FATAL.value,
+ body=_encode_value(
+ "This instrumentation scope has a schema url
and attributes"
+ ),
+ attributes=_encode_attributes(
+ {
+ "extended": {
+ "sequence": [
+ {"inner": "mapping", "none": None}
+ ]
+ }
+ }
),
- log_records=[
- PB2LogRecord(
- time_unix_nano=None,
-
observed_time_unix_nano=1644650584292683045,
- trace_id=_encode_trace_id(
- 212592107417388365804938480559624925566
- ),
- span_id=_encode_span_id(
- 6077757853989569466,
- ),
- flags=int(TraceFlags(0x01)),
- severity_text=None,
- severity_number=None,
- body=None,
- attributes=None,
- ),
- ],
- ),
+ )
],
- ),
- ]
+ schema_url="instrumentation_schema_url",
+ )
+ ],
+ )
+ self.assertEqual(
+ encode_logs(
+ [log_record_with_empty_resource_and_dict_attribute_value]
+ ),
+ ExportLogsServiceRequest(resource_logs=[pb2_resource_logs]),
)
- return sdk_logs, pb2_service_request
+ def test_dropped_attributes_count(self):
+ sdk_logs = self._get_test_logs_dropped_attributes()
+ encoded_logs = encode_logs(sdk_logs)
+ self.assertTrue(hasattr(sdk_logs[0], "dropped_attributes"))
+ self.assertEqual(
+ # pylint:disable=no-member
+ encoded_logs.resource_logs[0]
+ .scope_logs[0]
+ .log_records[0]
+ .dropped_attributes_count,
+ 2,
+ )
@staticmethod
def _get_test_logs_dropped_attributes() -> list[ReadWriteLogRecord]: