@@ -43,47 +43,3 @@ def test_configuration_metrics(self):
4343 for metric in metrics :
4444 self .assertIsNotNone (metric .metric .exponential_histogram )
4545 self .assertEqual (metric .metric .exponential_histogram .aggregation_temporality , AggregationTemporality .DELTA )
46-
47- # TODO: This does not work as expected, gives errors like 1467067824 not greater than 1746657330
48- # def test_xray_id_format(self):
49- # """
50- # We are testing here that the X-Ray id format is always used by inspecting the traceid that
51- # was in the span received by the collector, which should be consistent across multiple spans.
52- # We are testing the following properties:
53- # 1. Traceid is random
54- # 2. First 32 bits of traceid is a timestamp
55- # It is important to remember that the X-Ray traceId format had to be adapted to fit into the
56- # definition of the OpenTelemetry traceid:
57- # https://opentelemetry.io/docs/specs/otel/trace/api/#retrieving-the-traceid-and-spanid
58- # Specifically for an X-Ray traceid to be a valid Otel traceId, the version digit had to be
59- # dropped. Reference:
60- # https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/trace/aws_xray_id_generator.py
61- # """
62- #
63- # seen: List[str] = []
64- # for _ in range(100):
65- # address: str = self.application.get_container_host_ip()
66- # port: str = self.application.get_exposed_port(self.get_application_port())
67- # url: str = f"http://{address}:{port}/success"
68- # response: Response = request("GET", url, timeout=20)
69- # self.assertEqual(200, response.status_code)
70- #
71- # # Since we just made the request, the time in epoch registered in the traceid should be
72- # # approximate equal to the current time in the test, since both run on the same host.
73- # start_time_sec: int = int(time.time())
74- #
75- # resource_scope_spans: List[ResourceScopeSpan] = self.mock_collector_client.get_traces()
76- # target_span: ResourceScopeSpan = resource_scope_spans[0]
77- # self.assertEqual(target_span.span.name, "GET /success")
78- #
79- # self.assertTrue(target_span.span.trace_id.hex() not in seen)
80- # seen.append(target_span.span.trace_id.hex())
81- #
82- # # trace_id is bytes, so we convert it to hex string and pick the first 8 byte
83- # # that represent the timestamp, then convert it to int for timestamp in second
84- # trace_id_time_stamp_int: int = int(target_span.span.trace_id.hex()[:8], 16)
85- #
86- # # Give 2 minutes time range of tolerance for the trace timestamp
87- # self.assertGreater(trace_id_time_stamp_int, start_time_sec - 60)
88- # self.assertGreater(start_time_sec + 60, trace_id_time_stamp_int)
89- # self.mock_collector_client.clear_signals()
0 commit comments