Bug 2275084 - python-opentelemetry fails to build with pytest 8: AssertionError: spans[201 chars]me: "unknown_service"
Summary: python-opentelemetry fails to build with pytest 8: AssertionError: spans[201 ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-opentelemetry
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-04-15 10:02 UTC by Tomáš Hrnčiar
Modified: 2024-04-15 16:18 UTC (History)
6 users (show)

Fixed In Version: python-opentelemetry-1.24.0-4.fc41
Clone Of:
Environment:
Last Closed: 2024-04-15 16:18:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2024-04-15 10:02:40 UTC
python-opentelemetry fails to build with pytest 8.

=================================== FAILURES ===================================
_______________________ TestProtobufEncoder.test_encode ________________________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode>

    def test_encode(self):
        local_endpoint = zipkin_pb2.Endpoint(service_name=TEST_SERVICE_NAME)
        span_kind = ProtobufEncoder.SPAN_KIND_MAP[SpanKind.INTERNAL]
    
        otel_spans = self.get_exhaustive_otel_span_list()
        trace_id = ProtobufEncoder._encode_trace_id(
            otel_spans[0].context.trace_id
        )
        expected_output = zipkin_pb2.ListOfSpans(
            spans=[
                zipkin_pb2.Span(
                    trace_id=trace_id,
                    id=ProtobufEncoder._encode_span_id(
                        otel_spans[0].context.span_id
                    ),
                    name=otel_spans[0].name,
                    timestamp=ProtobufEncoder._nsec_to_usec_round(
                        otel_spans[0].start_time
                    ),
                    duration=(
                        ProtobufEncoder._nsec_to_usec_round(
                            otel_spans[0].end_time - otel_spans[0].start_time
                        )
                    ),
                    local_endpoint=local_endpoint,
                    kind=span_kind,
                    tags={
                        "key_bool": "false",
                        "key_string": "hello_world",
                        "key_float": "111.22",
                        "otel.status_code": "OK",
                    },
                    debug=True,
                    parent_id=ProtobufEncoder._encode_span_id(
                        otel_spans[0].parent.span_id
                    ),
                    annotations=[
                        zipkin_pb2.Annotation(
                            timestamp=ProtobufEncoder._nsec_to_usec_round(
                                otel_spans[0].events[0].timestamp
                            ),
                            value=json.dumps(
                                {
                                    "event0": {
                                        "annotation_bool": True,
                                        "annotation_string": "annotation_test",
                                        "key_float": 0.3,
                                    }
                                },
                                sort_keys=True,
                            ),
                        ),
                    ],
                ),
                zipkin_pb2.Span(
                    trace_id=trace_id,
                    id=ProtobufEncoder._encode_span_id(
                        otel_spans[1].context.span_id
                    ),
                    name=otel_spans[1].name,
                    timestamp=ProtobufEncoder._nsec_to_usec_round(
                        otel_spans[1].start_time
                    ),
                    duration=(
                        ProtobufEncoder._nsec_to_usec_round(
                            otel_spans[1].end_time - otel_spans[1].start_time
                        )
                    ),
                    local_endpoint=local_endpoint,
                    kind=span_kind,
                    tags={
                        "key_resource": "some_resource",
                        "otel.status_code": "ERROR",
                        "error": "Example description",
                    },
                    debug=False,
                ),
                zipkin_pb2.Span(
                    trace_id=trace_id,
                    id=ProtobufEncoder._encode_span_id(
                        otel_spans[2].context.span_id
                    ),
                    name=otel_spans[2].name,
                    timestamp=ProtobufEncoder._nsec_to_usec_round(
                        otel_spans[2].start_time
                    ),
                    duration=(
                        ProtobufEncoder._nsec_to_usec_round(
                            otel_spans[2].end_time - otel_spans[2].start_time
                        )
                    ),
                    local_endpoint=local_endpoint,
                    kind=span_kind,
                    tags={
                        "key_string": "hello_world",
                        "key_resource": "some_resource",
                    },
                    debug=False,
                ),
                zipkin_pb2.Span(
                    trace_id=trace_id,
                    id=ProtobufEncoder._encode_span_id(
                        otel_spans[3].context.span_id
                    ),
                    name=otel_spans[3].name,
                    timestamp=ProtobufEncoder._nsec_to_usec_round(
                        otel_spans[3].start_time
                    ),
                    duration=(
                        ProtobufEncoder._nsec_to_usec_round(
                            otel_spans[3].end_time - otel_spans[3].start_time
                        )
                    ),
                    local_endpoint=local_endpoint,
                    kind=span_kind,
                    tags={
                        NAME_KEY: "name",
                        VERSION_KEY: "version",
                        _SCOPE_NAME_KEY: "name",
                        _SCOPE_VERSION_KEY: "version",
                    },
                    debug=False,
                ),
            ],
        )
    
        actual_output = zipkin_pb2.ListOfSpans.FromString(
            ProtobufEncoder().serialize(otel_spans, NodeEndpoint())
        )
    
>       self.assertEqual(actual_output, expected_output)
E       AssertionError: spans[242 chars]me: "unknown_service"
E         }
E         annotations {
E           [1604 chars] }
E       }
E        != spans[242 chars]me: "test_service"
E         }
E         annotations {
E           tim[1592 chars] }
E       }

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:209: AssertionError
____________ TestProtobufEncoder.test_encode_local_endpoint_default ____________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_local_endpoint_default>

    def test_encode_local_endpoint_default(self):
>       self.assertEqual(
            ProtobufEncoder()._encode_local_endpoint(NodeEndpoint()),
            zipkin_pb2.Endpoint(service_name=TEST_SERVICE_NAME),
        )
E       AssertionError: service_name: "unknown_service"
E        != service_name: "test_service"

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:58: AssertionError
___________ TestProtobufEncoder.test_encode_local_endpoint_explicits ___________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_local_endpoint_explicits>

    def test_encode_local_endpoint_explicits(self):
        ipv4 = "192.168.0.1"
        ipv6 = "2001:db8::c001"
        port = 414120
>       self.assertEqual(
            ProtobufEncoder()._encode_local_endpoint(
                NodeEndpoint(ipv4, ipv6, port)
            ),
            zipkin_pb2.Endpoint(
                service_name=TEST_SERVICE_NAME,
                ipv4=ipaddress.ip_address(ipv4).packed,
                ipv6=ipaddress.ip_address(ipv6).packed,
                port=port,
            ),
        )
E       AssertionError: service_name: "unknown_service"
E       ipv4: "\300\250\000\001"[77 chars]4120
E        != service_name: "test_service"
E       ipv4: "\300\250\000\001"
E       ip[74 chars]4120

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:67: AssertionError
______________ TestProtobufEncoder.test_encode_max_tag_length_10 _______________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_max_tag_length_10>

    def test_encode_max_tag_length_10(self):
>       self._test_encode_max_tag_length(10)

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/common_tests.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:250: in _test_encode_max_tag_length
    self.assertEqual(actual_output, expected_output)
E   AssertionError: spans[201 chars]me: "unknown_service"
E     }
E     tags {
E       key: "e[1007 chars]ue
E   }
E    != spans[201 chars]me: "test_service"
E     }
E     tags {
E       key: "empt[1004 chars]ue
E   }
______________ TestProtobufEncoder.test_encode_max_tag_length_11 _______________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_max_tag_length_11>

    def test_encode_max_tag_length_11(self):
>       self._test_encode_max_tag_length(11)

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/common_tests.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:250: in _test_encode_max_tag_length
    self.assertEqual(actual_output, expected_output)
E   AssertionError: spans[201 chars]me: "unknown_service"
E     }
E     tags {
E       key: "e[1009 chars]ue
E   }
E    != spans[201 chars]me: "test_service"
E     }
E     tags {
E       key: "empt[1006 chars]ue
E   }
______________ TestProtobufEncoder.test_encode_max_tag_length_128 ______________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_max_tag_length_128>

    def test_encode_max_tag_length_128(self):
>       self._test_encode_max_tag_length(128)

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/common_tests.py:80: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:250: in _test_encode_max_tag_length
    self.assertEqual(actual_output, expected_output)
E   AssertionError: spans[201 chars]me: "unknown_service"
E     }
E     tags {
E       key: "e[2593 chars]ue
E   }
E    != spans[201 chars]me: "test_service"
E     }
E     tags {
E       key: "empt[2590 chars]ue
E   }
_______________ TestProtobufEncoder.test_encode_max_tag_length_2 _______________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_max_tag_length_2>

    def test_encode_max_tag_length_2(self):
>       self._test_encode_max_tag_length(2)

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/common_tests.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:250: in _test_encode_max_tag_length
    self.assertEqual(actual_output, expected_output)
E   AssertionError: spans[201 chars]me: "unknown_service"
E     }
E     tags {
E       key: "e[840 chars]ue
E   }
E    != spans[201 chars]me: "test_service"
E     }
E     tags {
E       key: "empt[837 chars]ue
E   }
_______________ TestProtobufEncoder.test_encode_max_tag_length_5 _______________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_max_tag_length_5>

    def test_encode_max_tag_length_5(self):
>       self._test_encode_max_tag_length(5)

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/common_tests.py:68: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:250: in _test_encode_max_tag_length
    self.assertEqual(actual_output, expected_output)
E   AssertionError: spans[201 chars]me: "unknown_service"
E     }
E     tags {
E       key: "e[896 chars]ue
E   }
E    != spans[201 chars]me: "test_service"
E     }
E     tags {
E       key: "empt[893 chars]ue
E   }
_______________ TestProtobufEncoder.test_encode_max_tag_length_9 _______________

self = <tests.encoder.test_v2_protobuf.TestProtobufEncoder testMethod=test_encode_max_tag_length_9>

    def test_encode_max_tag_length_9(self):
>       self._test_encode_max_tag_length(9)

exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/common_tests.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/test_v2_protobuf.py:250: in _test_encode_max_tag_length
    self.assertEqual(actual_output, expected_output)
E   AssertionError: spans[201 chars]me: "unknown_service"
E     }
E     tags {
E       key: "e[1005 chars]ue
E   }
E    != spans[201 chars]me: "test_service"
E     }
E     tags {
E       key: "empt[1002 chars]ue
E   }

=================== 9 failed, 24 passed, 3 warnings in 1.15s ===================

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07266065-python-opentelemetry/

For all our attempts to build python-opentelemetry with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-opentelemetry/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Fedora Update System 2024-04-15 16:15:13 UTC
FEDORA-2024-a84de3140e (python-opentelemetry-1.24.0-4.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-a84de3140e

Comment 2 Fedora Update System 2024-04-15 16:18:26 UTC
FEDORA-2024-a84de3140e (python-opentelemetry-1.24.0-4.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.