File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed
instrumentation/opentelemetry-instrumentation-fastapi/tests Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -348,22 +348,20 @@ def test_custom_api_router(self):
348348 """
349349 resp : Final = self ._client .get ("/custom-router/success" )
350350 spans : Final = self .memory_exporter .get_finished_spans ()
351- expected_span_attributes : Final = {
352- HTTP_TARGET : "/custom-router/success" ,
353- HTTP_URL : "https://testserver/" ,
354- }
351+ spans_with_http_attributes = [
352+ span
353+ for span in spans
354+ if (HTTP_URL in span .attributes or HTTP_TARGET in span .attributes )
355+ ]
355356 self .assertEqual (200 , resp .status_code )
356- self .assertTrue (
357- all (
358- all (
359- (
360- span .attributes [attribute ] == expected
361- for attribute , expected in expected_span_attributes .items ()
362- )
363- )
364- for span in spans
357+ for span in spans_with_http_attributes :
358+ self .assertEqual (
359+ "/custom-router/success" , span .attributes [HTTP_TARGET ]
360+ )
361+ self .assertEqual (
362+ "https://testserver/custom-router/success" ,
363+ span .attributes [HTTP_URL ],
365364 )
366- )
367365
368366 def test_host_fastapi_call (self ):
369367 client = TestClient (self ._app , base_url = "https://testserver2:443" )
You can’t perform that action at this time.
0 commit comments