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 2025-05-27 18:44:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-opentelemetry-exporter-otlp-proto-common (Old) and /work/SRC/openSUSE:Factory/.python-opentelemetry-exporter-otlp-proto-common.new.2732 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-opentelemetry-exporter-otlp-proto-common" Tue May 27 18:44:07 2025 rev:10 rq:1280596 version:1.33.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-opentelemetry-exporter-otlp-proto-common/python-opentelemetry-exporter-otlp-proto-common.changes 2025-02-26 17:19:39.518064048 +0100 +++ /work/SRC/openSUSE:Factory/.python-opentelemetry-exporter-otlp-proto-common.new.2732/python-opentelemetry-exporter-otlp-proto-common.changes 2025-05-27 18:44:14.685738490 +0200 @@ -1,0 +2,16 @@ +Mon May 26 07:26:19 UTC 2025 - Nico Krapp <nico.kr...@suse.com> + +- Update to 1.33.1 + * Remove log messages from BatchLogRecordProcessor.emit, this caused the + program to crash at shutdown with a max recursion error +- Update to 1.33.0 + * Fix intermittent Connection aborted error when using otlp/http exporters + * opentelemetry-sdk: use stable code attributes: + code.function -> code.function.name, code.lineno -> code.line.number, + code.filepath -> code.file.path + * Fix serialization of extended attributes for logs signal + * Handle OTEL_PROPAGATORS contains None + * docs: updated and added to the metrics and log examples + * Bump semantic conventions to 1.33.0 + +------------------------------------------------------------------- Old: ---- opentelemetry_exporter_otlp_proto_common-1.30.0.tar.gz New: ---- opentelemetry_exporter_otlp_proto_common-1.33.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-opentelemetry-exporter-otlp-proto-common.spec ++++++ --- /var/tmp/diff_new_pack.1w970M/_old 2025-05-27 18:44:15.289763907 +0200 +++ /var/tmp/diff_new_pack.1w970M/_new 2025-05-27 18:44:15.293764076 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-opentelemetry-exporter-otlp-proto-common -Version: 1.30.0 +Version: 1.33.1 Release: 0 Summary: OpenTelemetry Protobuf encoding License: Apache-2.0 ++++++ opentelemetry_exporter_otlp_proto_common-1.30.0.tar.gz -> opentelemetry_exporter_otlp_proto_common-1.33.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/PKG-INFO new/opentelemetry_exporter_otlp_proto_common-1.33.1/PKG-INFO --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/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.30.0 +Version: 1.33.1 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 @@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Requires-Python: >=3.8 -Requires-Dist: opentelemetry-proto==1.30.0 +Requires-Dist: opentelemetry-proto==1.33.1 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.30.0/pyproject.toml new/opentelemetry_exporter_otlp_proto_common-1.33.1/pyproject.toml --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -28,7 +28,7 @@ "Programming Language :: Python :: 3.13", ] dependencies = [ - "opentelemetry-proto == 1.30.0", + "opentelemetry-proto == 1.33.1", ] [project.urls] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -45,7 +45,7 @@ ) from opentelemetry.sdk.trace import Resource from opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opentelemetry.util.types import Attributes +from opentelemetry.util.types import _ExtendedAttributes _logger = logging.getLogger(__name__) @@ -61,6 +61,7 @@ return PB2InstrumentationScope( name=instrumentation_scope.name, version=instrumentation_scope.version, + attributes=_encode_attributes(instrumentation_scope.attributes), ) @@ -135,14 +136,17 @@ def _encode_attributes( - attributes: Attributes, + attributes: _ExtendedAttributes, + allow_null: bool = False, ) -> Optional[List[PB2KeyValue]]: if attributes: pb2_attributes = [] for key, value in attributes.items(): # pylint: disable=broad-exception-caught try: - pb2_attributes.append(_encode_key_value(key, value)) + 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: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/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.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -57,7 +57,9 @@ flags=int(log_data.log_record.trace_flags), body=_encode_value(body, allow_null=True), severity_text=log_data.log_record.severity_text, - attributes=_encode_attributes(log_data.log_record.attributes), + attributes=_encode_attributes( + log_data.log_record.attributes, allow_null=True + ), dropped_attributes_count=log_data.log_record.dropped_attributes, severity_number=log_data.log_record.severity_number.value, ) @@ -82,6 +84,9 @@ ScopeLogs( scope=(_encode_instrumentation_scope(sdk_instrumentation)), log_records=pb2_logs, + schema_url=sdk_instrumentation.schema_url + if sdk_instrumentation + else None, ) ) pb2_resource_logs.append( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -11,19 +11,21 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations + import logging from os import environ from typing import Dict, List from opentelemetry.exporter.otlp.proto.common._internal import ( _encode_attributes, + _encode_instrumentation_scope, _encode_span_id, _encode_trace_id, ) from opentelemetry.proto.collector.metrics.v1.metrics_service_pb2 import ( ExportMetricsServiceRequest, ) -from opentelemetry.proto.common.v1.common_pb2 import InstrumentationScope from opentelemetry.proto.metrics.v1 import metrics_pb2 as pb2 from opentelemetry.proto.resource.v1.resource_pb2 import ( Resource as PB2Resource, @@ -66,8 +68,9 @@ class OTLPMetricExporterMixin: def _common_configuration( self, - preferred_temporality: Dict[type, AggregationTemporality] = None, - preferred_aggregation: Dict[type, Aggregation] = None, + preferred_temporality: dict[type, AggregationTemporality] + | None = None, + preferred_aggregation: dict[type, Aggregation] | None = None, ) -> None: MetricExporter.__init__( self, @@ -114,8 +117,9 @@ _logger.warning( "Unrecognized OTEL_EXPORTER_METRICS_TEMPORALITY_PREFERENCE" " value found: " - f"{otel_exporter_otlp_metrics_temporality_preference}, " - "using CUMULATIVE" + "%s, " + "using CUMULATIVE", + otel_exporter_otlp_metrics_temporality_preference, ) instrument_class_temporality = { Counter: AggregationTemporality.CUMULATIVE, @@ -219,10 +223,8 @@ # there is no need to check for existing instrumentation scopes # here. pb2_scope_metrics = pb2.ScopeMetrics( - scope=InstrumentationScope( - name=instrumentation_scope.name, - version=instrumentation_scope.version, - ) + scope=_encode_instrumentation_scope(instrumentation_scope), + schema_url=instrumentation_scope.schema_url, ) scope_metrics_dict[instrumentation_scope] = pb2_scope_metrics diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/_internal/trace_encoder/__init__.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/trace_encoder/__init__.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/_internal/trace_encoder/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/_internal/trace_encoder/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -89,6 +89,9 @@ PB2ScopeSpans( scope=(_encode_instrumentation_scope(sdk_instrumentation)), spans=pb2_spans, + schema_url=sdk_instrumentation.schema_url + if sdk_instrumentation + else None, ) ) pb2_resource_spans.append( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/src/opentelemetry/exporter/otlp/proto/common/version/__init__.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.30.0" +__version__ = "1.33.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/tests/test_log_encoder.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/tests/test_log_encoder.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/tests/test_log_encoder.py 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/tests/test_log_encoder.py 2020-02-02 01:00:00.000000000 +0100 @@ -178,7 +178,75 @@ ), ) - return [log1, log2, log3, log4, log5] + log6 = LogData( + log_record=SDKLogRecord( + timestamp=1644650584292683022, + observed_timestamp=1644650584292683022, + trace_id=212592107417388365804938480559624925522, + span_id=6077757853989569222, + trace_flags=TraceFlags(0x01), + severity_text="ERROR", + severity_number=SeverityNumber.ERROR, + body="This instrumentation scope has a schema url", + resource=SDKResource( + {"first_resource": "value"}, + "resource_schema_url", + ), + attributes={"filename": "model.py", "func_name": "run_method"}, + ), + instrumentation_scope=InstrumentationScope( + "scope_with_url", + "scope_with_url_version", + "instrumentation_schema_url", + ), + ) + + log7 = LogData( + log_record=SDKLogRecord( + timestamp=1644650584292683033, + observed_timestamp=1644650584292683033, + trace_id=212592107417388365804938480559624925533, + span_id=6077757853989569233, + trace_flags=TraceFlags(0x01), + severity_text="FATAL", + severity_number=SeverityNumber.FATAL, + body="This instrumentation scope has a schema url and attributes", + resource=SDKResource( + {"first_resource": "value"}, + "resource_schema_url", + ), + attributes={"filename": "model.py", "func_name": "run_method"}, + ), + instrumentation_scope=InstrumentationScope( + "scope_with_attributes", + "scope_with_attributes_version", + "instrumentation_schema_url", + {"one": 1, "two": "2"}, + ), + ) + + log8 = LogData( + log_record=SDKLogRecord( + timestamp=1644650584292683044, + observed_timestamp=1644650584292683044, + trace_id=212592107417388365804938480559624925566, + span_id=6077757853989569466, + trace_flags=TraceFlags(0x01), + severity_text="INFO", + severity_number=SeverityNumber.INFO, + body="Test export of extended attributes", + resource=SDKResource({}), + attributes={ + "extended": { + "sequence": [{"inner": "mapping", "none": None}] + } + }, + ), + instrumentation_scope=InstrumentationScope( + "extended_name", "extended_version" + ), + ) + return [log1, log2, log3, log4, log5, log6, log7, log8] def get_test_logs( self, @@ -218,7 +286,8 @@ "Do not go gentle into that good night. Rage, rage against the dying of the light" ), attributes=_encode_attributes( - {"a": 1, "b": "c"} + {"a": 1, "b": "c"}, + allow_null=True, ), ) ], @@ -248,7 +317,76 @@ { "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, ), ) ], @@ -304,7 +442,8 @@ severity_number=SeverityNumber.DEBUG.value, body=_encode_value("To our galaxy"), attributes=_encode_attributes( - {"a": 1, "b": "c"} + {"a": 1, "b": "c"}, + allow_null=True, ), ), ], @@ -359,6 +498,43 @@ ), ], ), + 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, + ), + ), + ], + ), ], ), ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/tests/test_metrics_encoder.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/tests/test_metrics_encoder.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/tests/test_metrics_encoder.py 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/tests/test_metrics_encoder.py 2020-02-02 01:00:00.000000000 +0100 @@ -110,7 +110,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[_generate_sum("sum_int", 33)], schema_url="instrumentation_scope_schema_url", @@ -137,6 +137,7 @@ scope=InstrumentationScope( name="first_name", version="first_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="sum_int", @@ -190,7 +191,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[_generate_sum("sum_double", 2.98)], schema_url="instrumentation_scope_schema_url", @@ -217,6 +218,7 @@ scope=InstrumentationScope( name="first_name", version="first_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="sum_double", @@ -270,7 +272,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[_generate_gauge("gauge_int", 9000)], schema_url="instrumentation_scope_schema_url", @@ -297,6 +299,7 @@ scope=InstrumentationScope( name="first_name", version="first_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="gauge_int", @@ -348,7 +351,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[_generate_gauge("gauge_double", 52.028)], schema_url="instrumentation_scope_schema_url", @@ -375,6 +378,7 @@ scope=InstrumentationScope( name="first_name", version="first_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="gauge_double", @@ -425,7 +429,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[self.histogram], schema_url="instrumentation_scope_schema_url", @@ -452,6 +456,7 @@ scope=InstrumentationScope( name="first_name", version="first_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="histogram", @@ -537,7 +542,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[self.histogram, self.histogram], schema_url="instrumentation_scope_schema_url", @@ -546,7 +551,7 @@ scope=SDKInstrumentationScope( name="second_name", version="second_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[self.histogram], schema_url="instrumentation_scope_schema_url", @@ -555,7 +560,7 @@ scope=SDKInstrumentationScope( name="third_name", version="third_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[self.histogram], schema_url="instrumentation_scope_schema_url", @@ -582,6 +587,7 @@ scope=InstrumentationScope( name="first_name", version="first_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="histogram", @@ -713,6 +719,7 @@ scope=InstrumentationScope( name="second_name", version="second_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="histogram", @@ -782,6 +789,7 @@ scope=InstrumentationScope( name="third_name", version="third_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="histogram", @@ -892,7 +900,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[exponential_histogram], schema_url="instrumentation_scope_schema_url", @@ -919,6 +927,7 @@ scope=InstrumentationScope( name="first_name", version="first_version" ), + schema_url="instrumentation_scope_schema_url", metrics=[ pb2.Metric( name="exponential_histogram", @@ -989,7 +998,7 @@ scope=SDKInstrumentationScope( name="first_name", version="first_version", - schema_url="insrumentation_scope_schema_url", + schema_url="instrumentation_scope_schema_url", ), metrics=[_generate_sum("sum_double", big_number)], schema_url="instrumentation_scope_schema_url", @@ -1005,3 +1014,88 @@ # assert that the EncodingException wraps the metric and original exception assert isinstance(context.exception.metric, Metric) assert isinstance(context.exception.original_exception, ValueError) + + def test_encode_scope_with_attributes(self): + metrics_data = MetricsData( + resource_metrics=[ + ResourceMetrics( + resource=Resource( + attributes=None, + schema_url="resource_schema_url", + ), + scope_metrics=[ + ScopeMetrics( + scope=SDKInstrumentationScope( + name="first_name", + version="first_version", + schema_url="instrumentation_scope_schema_url", + attributes={"one": 1, "two": "2"}, + ), + metrics=[_generate_sum("sum_int", 88)], + schema_url="instrumentation_scope_schema_url", + ) + ], + schema_url="resource_schema_url", + ) + ] + ) + expected = ExportMetricsServiceRequest( + resource_metrics=[ + pb2.ResourceMetrics( + schema_url="resource_schema_url", + resource=OTLPResource(), + scope_metrics=[ + pb2.ScopeMetrics( + scope=InstrumentationScope( + name="first_name", + version="first_version", + attributes=[ + KeyValue( + key="one", value=AnyValue(int_value=1) + ), + KeyValue( + key="two", + value=AnyValue(string_value="2"), + ), + ], + ), + schema_url="instrumentation_scope_schema_url", + metrics=[ + pb2.Metric( + name="sum_int", + unit="s", + description="foo", + sum=pb2.Sum( + data_points=[ + pb2.NumberDataPoint( + attributes=[ + KeyValue( + key="a", + value=AnyValue( + int_value=1 + ), + ), + KeyValue( + key="b", + value=AnyValue( + bool_value=True + ), + ), + ], + start_time_unix_nano=1641946015139533244, + time_unix_nano=1641946016139533244, + as_int=88, + ) + ], + aggregation_temporality=AggregationTemporality.CUMULATIVE, + is_monotonic=True, + ), + ) + ], + ) + ], + ) + ] + ) + actual = encode_metrics(metrics_data) + self.assertEqual(expected, actual) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opentelemetry_exporter_otlp_proto_common-1.30.0/tests/test_trace_encoder.py new/opentelemetry_exporter_otlp_proto_common-1.33.1/tests/test_trace_encoder.py --- old/opentelemetry_exporter_otlp_proto_common-1.30.0/tests/test_trace_encoder.py 2020-02-02 01:00:00.000000000 +0100 +++ new/opentelemetry_exporter_otlp_proto_common-1.33.1/tests/test_trace_encoder.py 2020-02-02 01:00:00.000000000 +0100 @@ -72,12 +72,16 @@ base_time + 150 * 10**6, base_time + 300 * 10**6, base_time + 400 * 10**6, + base_time + 500 * 10**6, + base_time + 600 * 10**6, ) end_times = ( start_times[0] + (50 * 10**6), start_times[1] + (100 * 10**6), start_times[2] + (200 * 10**6), start_times[3] + (300 * 10**6), + start_times[4] + (400 * 10**6), + start_times[5] + (500 * 10**6), ) parent_span_context = SDKSpanContext( @@ -151,7 +155,42 @@ span4.start(start_time=start_times[3]) span4.end(end_time=end_times[3]) - return [span1, span2, span3, span4] + span5 = SDKSpan( + name="test-span-5", + context=other_context, + parent=None, + resource=SDKResource( + attributes={"key_resource": "another_resource"}, + schema_url="resource_schema_url", + ), + instrumentation_scope=SDKInstrumentationScope( + name="scope_1_name", + version="scope_1_version", + schema_url="scope_1_schema_url", + ), + ) + span5.start(start_time=start_times[4]) + span5.end(end_time=end_times[4]) + + span6 = SDKSpan( + name="test-span-6", + context=other_context, + parent=None, + resource=SDKResource( + attributes={"key_resource": "another_resource"}, + schema_url="resource_schema_url", + ), + instrumentation_scope=SDKInstrumentationScope( + name="scope_2_name", + version="scope_2_version", + schema_url="scope_2_schema_url", + attributes={"one": "1", "two": 2}, + ), + ) + span6.start(start_time=start_times[5]) + span6.end(end_time=end_times[5]) + + return [span1, span2, span3, span4, span5, span6] def get_exhaustive_test_spans( self, @@ -356,6 +395,86 @@ ) ], ), + PB2ResourceSpans( + resource=PB2Resource( + attributes=[ + PB2KeyValue( + key="key_resource", + value=PB2AnyValue( + string_value="another_resource" + ), + ), + ], + ), + schema_url="resource_schema_url", + scope_spans=[ + PB2ScopeSpans( + scope=PB2InstrumentationScope( + name="scope_1_name", version="scope_1_version" + ), + schema_url="scope_1_schema_url", + spans=[ + PB2SPan( + trace_id=trace_id, + span_id=_encode_span_id( + otel_spans[4].context.span_id + ), + trace_state=None, + parent_span_id=None, + name=otel_spans[4].name, + kind=span_kind, + start_time_unix_nano=otel_spans[ + 4 + ].start_time, + end_time_unix_nano=otel_spans[4].end_time, + attributes=None, + events=None, + links=None, + status={}, + flags=0x100, + ), + ], + ), + PB2ScopeSpans( + scope=PB2InstrumentationScope( + name="scope_2_name", + version="scope_2_version", + attributes=[ + PB2KeyValue( + key="one", + value=PB2AnyValue(string_value="1"), + ), + PB2KeyValue( + key="two", + value=PB2AnyValue(int_value=2), + ), + ], + ), + schema_url="scope_2_schema_url", + spans=[ + PB2SPan( + trace_id=trace_id, + span_id=_encode_span_id( + otel_spans[5].context.span_id + ), + trace_state=None, + parent_span_id=None, + name=otel_spans[5].name, + kind=span_kind, + start_time_unix_nano=otel_spans[ + 5 + ].start_time, + end_time_unix_nano=otel_spans[5].end_time, + attributes=None, + events=None, + links=None, + status={}, + flags=0x100, + ), + ], + ), + ], + ), ] )