|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 |
| -# pylint: disable=too-many-lines |
16 |
| - |
17 | 15 | import sys
|
18 | 16 | import unittest
|
19 | 17 | from timeit import default_timer
|
@@ -585,37 +583,6 @@ def test_basic_metric_success(self):
|
585 | 583 | )
|
586 | 584 | self.assertEqual(point.value, 0)
|
587 | 585 |
|
588 |
| - def test_metric_target_attribute(self): |
589 |
| - expected_target = "/api/user/{id}" |
590 |
| - |
591 |
| - class TestRoute: |
592 |
| - path_format = expected_target |
593 |
| - |
594 |
| - self.scope["route"] = TestRoute() |
595 |
| - app = otel_asgi.OpenTelemetryMiddleware(simple_asgi) |
596 |
| - self.seed_app(app) |
597 |
| - self.send_default_request() |
598 |
| - |
599 |
| - metrics_list = self.memory_metrics_reader.get_metrics_data() |
600 |
| - assertions = 0 |
601 |
| - for resource_metric in metrics_list.resource_metrics: |
602 |
| - for scope_metrics in resource_metric.scope_metrics: |
603 |
| - for metric in scope_metrics.metrics: |
604 |
| - for point in metric.data.data_points: |
605 |
| - if isinstance(point, HistogramDataPoint): |
606 |
| - self.assertEqual( |
607 |
| - point.attributes["http.target"], |
608 |
| - expected_target, |
609 |
| - ) |
610 |
| - assertions += 1 |
611 |
| - elif isinstance(point, NumberDataPoint): |
612 |
| - self.assertEqual( |
613 |
| - point.attributes["http.target"], |
614 |
| - expected_target, |
615 |
| - ) |
616 |
| - assertions += 1 |
617 |
| - self.assertEqual(assertions, 2) |
618 |
| - |
619 | 586 | def test_no_metric_for_websockets(self):
|
620 | 587 | self.scope = {
|
621 | 588 | "type": "websocket",
|
@@ -709,37 +676,6 @@ def test_credential_removal(self):
|
709 | 676 | attrs[SpanAttributes.HTTP_URL], "http://httpbin.org/status/200"
|
710 | 677 | )
|
711 | 678 |
|
712 |
| - def test_collect_target_attribute_missing(self): |
713 |
| - self.assertIsNone(otel_asgi._collect_target_attribute(self.scope)) |
714 |
| - |
715 |
| - def test_collect_target_attribute_fastapi(self): |
716 |
| - class TestRoute: |
717 |
| - path_format = "/api/users/{user_id}" |
718 |
| - |
719 |
| - self.scope["route"] = TestRoute() |
720 |
| - self.assertEqual( |
721 |
| - otel_asgi._collect_target_attribute(self.scope), |
722 |
| - "/api/users/{user_id}", |
723 |
| - ) |
724 |
| - |
725 |
| - def test_collect_target_attribute_fastapi_mounted(self): |
726 |
| - class TestRoute: |
727 |
| - path_format = "/users/{user_id}" |
728 |
| - |
729 |
| - self.scope["route"] = TestRoute() |
730 |
| - self.scope["root_path"] = "/api/v2" |
731 |
| - self.assertEqual( |
732 |
| - otel_asgi._collect_target_attribute(self.scope), |
733 |
| - "/api/v2/users/{user_id}", |
734 |
| - ) |
735 |
| - |
736 |
| - def test_collect_target_attribute_fastapi_starlette_invalid(self): |
737 |
| - self.scope["route"] = object() |
738 |
| - self.assertIsNone( |
739 |
| - otel_asgi._collect_target_attribute(self.scope), |
740 |
| - "HTTP_TARGET values is not None", |
741 |
| - ) |
742 |
| - |
743 | 679 |
|
744 | 680 | class TestWrappedApplication(AsgiTestBase):
|
745 | 681 | def test_mark_span_internal_in_presence_of_span_from_other_framework(self):
|
|
0 commit comments